Create discount
Changed onCreates a new discount code. The business must have Stripe connected: without it this answers 422 with code stripe_not_connected, and the body was not at fault.
Request
- Base URLhttps://api.crevio.co/v1
- AuthAPI key in header Authorization
Headers
Makes this write safe to retry: a repeat with the same key replays the first response instead of creating a second resource. Scoped to the account, remembered for 24 hours; reusing a key with a different payload is an error.
Request body
Letters, numbers, dashes and underscores. Unique per business regardless of case.
inactive turns the code off at once and checkout rejects it; active turns it back on. Leaves redeem_by and the code's products unchanged.
Amount off in the currency's smallest unit (cents), for a fixed discount.
Three-letter currency code. Required when discount_type is fixed or minimum_amount is set.
When the code becomes usable. Checkout rejects it before this time; omit it to make the code usable right away. For a sale that starts later, create the discount now with starts_at set rather than scheduling its creation.
When the code stops being usable. Must be after starts_at and in the future whenever it is set. To end a code now, set status to inactive.
How many live orders can use the code, across all contacts. Test purchases don't count. Can be lowered later, or set later on a code created without one; raising it past the number set at creation answers 422, so create a new code for more uses.
Smallest order subtotal, in cents before the discount, that can use the code. Requires currency; an order in another currency can't use the code. null removes it.
Each contact can use the code on one live order.
Only contacts with no earlier live paid order from this business can use the code. Free orders and test purchases don't count as earlier orders.
Response
Discount created
expired once redeem_by has passed on an active code. inactive means it was turned off.
The prices (price_...) the code works on. Empty means every price.
Changes
- warning
added the new
expiredenum value to thestatusresponse property for the response status
- warning
- breaking
added the pattern
^[a-zA-Z0-9_-]+$to the request propertycode - warning
the
amount_offrequest property's max was set to99999999.00
9 more changes in this revision
- breaking