The discount model
POST /discounts returns a discount with an id like disc_.... The shape is centered on two enums: the type of discount and its duration.
duration matters most for subscriptions: once discounts only the first charge, repeating discounts for duration_in_months, and forever discounts every charge. For one-time purchases the discount simply applies to that purchase.Worked example: a 20% launch code
A percentage code, capped at 500 redemptions, expiring in two weeks, applying to everything:Worked example: $10 off, scoped to one variant
A fixed-amount code that only works on a specific price variant:price_variants lists a single variant, SAVE10 is rejected at checkout for any other item.
Worked example: a welcome code for new customers
15% off a first order of at least $50, usable once per customer:minimum_amount, once_per_customer, and first_order_only can be changed later with PATCH /v1/discounts/{id}. Send "minimum_amount": null to remove the minimum.
Eligibility and redemptions
Crevio, not Stripe, decides whether a code applies. The checks run in this order, and the first failure is the reason the buyer sees:
The two customer checks need to know who is buying. A checkout created with
customer or email is checked when it’s created. On the hosted checkout page, a guest is checked again with the email they enter, before payment is taken. If a payment still completes with an ineligible code, the order is kept and the redemption is recorded.
A redemption is recorded when a live order paid with the code is created, which increments times_redeemed. Test purchases never count. A discount with at least one redemption can’t be deleted; set status to inactive instead.
Applying a discount
A discount reaches a buyer in one of two ways:At checkout — discount_code
Pass the code’s string when creating a checkout. Every eligibility check above runs against the checkout’s line items and its customer or email. A code that fails returns 400 with code: "invalid_parameter" and the reason as message, and no checkout is created:
On a checkout link — discount
Attach a discount by id to a reusable checkout link so it’s applied automatically, and decide whether buyers may also enter their own code:
In a link — ?discount=
Append ?discount=CODE to a buy link (/buy/{price_variant_or_checkout_link_id}) or a hosted checkout URL (/checkout/{checkout_id}). The checkout opens with the code applied, even when allow_discount_codes is false. An unusable code never errors: the checkout opens without it and shows the buyer the reason from the table above.
Discounts support full CRUD — create, update, delete, list, and retrieve.
Next steps
Checkouts
Apply discounts via
discount_code and on reusable checkout links.Products & pricing
Create the price variants you scope discounts to.
Subscriptions & billing
How
duration shapes discounts on recurring subscriptions.Commerce overview
See where discounts sit in the full commerce model.

