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.
Authorizations
Body
- DiscountFixedCreate
- DiscountPercentageCreate
Schema used to create a fixed amount discount.
Name: Name of the discount. Will be displayed to the customer when the discount is applied.
1Duration: For 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 Metadata map for information your integration needs to retain.
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: 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 At: Optional timestamp after which the discount is redeemable.
Ends At: Optional timestamp after which the discount is no longer redeemable.
Max Redemptions: Optional maximum number of times the discount can be redeemed.
1 <= x <= 2147483647Collection of product IDs the discount can be applied to.
Identifier of the organization.
"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 <= 999Amount: Fixed amount to discount from the invoice total.
0 <= x <= 999999999999Currency: 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 Amounts: Map of currency to fixed amount to discount from the total. This allows specifying different discount amounts for different currencies.
Response
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"
Amounts: 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: Name of the discount. Will be displayed to the customer when the discount is applied.
Code: Code customers can use to apply the discount during checkout.
Starts At: Timestamp after which the discount is redeemable.
Ends At: Timestamp after which the discount is no longer redeemable.
Max Redemptions: Maximum number of times the discount can be redeemed.
Count of times the discount has been redeemed.
Identifier of the organization.
"1dbfc517-0bbf-4301-9ba8-555ca42b9737"