Create Discount
Intent
Creates a discount from the values supplied in the request.
When to call it
Call this when your application has collected the required values and is ready to create a discount.
Access boundary
Authorize the request with a token that carries discounts:write.
Successful result
A successful request returns 201. The response schema below defines the body your integration receives.
Operational notes
Create a discount.
Scopes: discounts:write
Authorizations
You can generate an Organization Access Token from your organization's settings.
Body
- DiscountFixedCreate
- DiscountPercentageCreate
Schema to create a fixed amount discount.
Name of the discount. Will be displayed to the customer when the discount is applied.
1For subscriptions, determines if the discount should be applied once on the first invoice, forever, or for a certain number of months determined by duration_in_months.
once, forever, repeating 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.
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.
Optional timestamp after which the discount is redeemable.
Optional timestamp after which the discount is no longer redeemable.
Optional maximum number of times the discount can be redeemed.
1 <= x <= 2147483647List of product IDs the discount can be applied to.
The organization ID.
"1dbfc517-0bbf-4301-9ba8-555ca42b9737"
"fixed"Number of months the discount should be applied.
Required when duration is repeating. Must be omitted otherwise.
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.
1 <= x <= 999Fixed amount to discount from the invoice total.
0 <= x <= 999999999999The currency of the fixed amount discount.
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 Map of currency to fixed amount to discount from the total. This allows specifying different discount amounts for different currencies.
Response
Discount created.
- DiscountFixedOnceForeverDuration
- DiscountFixedRepeatDuration
- DiscountPercentageOnceForeverDuration
- DiscountPercentageRepeatDuration
Schema for a fixed amount discount that is applied once or forever.
once, forever, repeating fixed, percentage 1000
"usd"
Map of currency to fixed amount to discount from the total.
The time Ruba created this record.
The time this record last changed.
The stable identifier for this record.
Name of the discount. Will be displayed to the customer when the discount is applied.
Code customers can use to apply the discount during checkout.
Timestamp after which the discount is redeemable.
Timestamp after which the discount is no longer redeemable.
Maximum number of times the discount can be redeemed.
Number of times the discount has been redeemed.
The organization ID.
"1dbfc517-0bbf-4301-9ba8-555ca42b9737"