v6

latestOpenAPI 3.1.02026-07-311856741.1 MB
discounts
public

Update Discount

Update a discount.

Scopes: discounts:write

patch/v1/discounts/{id}

Path parameters

idstring uuid4 required

The discount ID.

The discount ID.

Request body

metadataobject

Key-value object allowing you to store additional information.

The key must be a string with a maximum length of 40 characters. The value must be either:

  • A string with a maximum length of 500 characters
  • An integer
  • A floating-point number
  • A boolean

You can store up to 50 key-value pairs.

namestring nullable

Name of the discount. Will be displayed to the customer when the discount is applied.

codestring nullable

Code customers can use to apply the discount during checkout. Must be between 3 and 256 characters long and contain only alphanumeric characters.If not provided, the discount can only be applied via the API.

starts_atstring date-time nullable

Optional timestamp after which the discount is redeemable.

ends_atstring date-time nullable

Optional timestamp after which the discount is no longer redeemable.

max_redemptionsinteger nullable

Optional maximum number of times the discount can be redeemed.

max_redemptions_per_customerinteger nullable

Optional maximum number of times the discount can be redeemed by a single customer.

duration'once' | 'forever' | 'repeating'
duration_in_monthsinteger nullable

Number of months the discount should be applied.

For this to work on yearly pricing, you should multiply this by 12. For example, to apply the discount for 2 years, set this to 24.

type'fixed' | 'percentage'
amountinteger nullable

Fixed amount to discount from the invoice total.

currency'aed' | 'all' | 'amd' | 'aoa' | 'ars' | 'aud' | 'awg' | 'azn' | 'bam' | 'bbd' | 'bdt' | 'bif' | 'bmd' | 'bnd' | 'bob' | 'brl' | 'bsd' | 'bwp' | 'bzd' | 'cad' | 'cdf' | 'chf' | 'clp' | 'cny' | 'cop' | 'crc' | 'cve' | 'czk' | 'djf' | 'dkk' | 'dop' | 'dzd' | 'egp' | 'etb' | 'eur' | 'fjd' | 'fkp' | 'gbp' | 'gel' | 'gip' | 'gmd' | 'gnf' | 'gtq' | 'gyd' | 'hkd' | 'hnl' | 'htg' | 'huf' | 'idr' | 'ils' | 'inr' | 'isk' | 'jmd' | 'jpy' | 'kes' | 'kgs' | 'khr' | 'kmf' | 'krw' | 'kyd' | 'kzt' | 'lak' | 'lkr' | 'lrd' | 'lsl' | 'mad' | 'mdl' | 'mga' | 'mkd' | 'mnt' | 'mop' | 'mur' | 'mvr' | 'mwk' | 'mxn' | 'myr' | 'mzn' | 'nad' | 'ngn' | 'nio' | 'nok' | 'npr' | 'nzd' | 'pab' | 'pen' | 'pgk' | 'php' | 'pkr' | 'pln' | 'pyg' | 'qar' | 'ron' | 'rsd' | 'rwf' | 'sar' | 'sbd' | 'scr' | 'sek' | 'sgd' | 'shp' | 'sos' | 'srd' | 'szl' | 'thb' | 'tjs' | 'top' | 'try' | 'ttd' | 'twd' | 'tzs' | 'uah' | 'ugx' | 'usd' | 'uyu' | 'uzs' | 'vnd' | 'vuv' | 'wst' | 'xaf' | 'xcd' | 'xcg' | 'xof' | 'xpf' | 'yer' | 'zar' | 'zmw'
amountsobject nullable

Map of currency to fixed amount to discount from the total. This allows specifying different discount amounts for different currencies.

basis_pointsinteger nullable

Discount percentage in basis points.

A basis point is 1/100th of a percent. For example, to create a 25.5% discount, set this to 2550.

productsstring[] nullable

List of product IDs the discount can be applied to.

Response

Discount updated.

OR
OR
OR

Example response

{
  "amount": 1000,
  "currency": "usd",
  "amounts": {
    "eur": 900,
    "usd": 1000
  },
  "organization_id": "1dbfc517-0bbf-4301-9ba8-555ca42b9737"
}