Update a discount
Authorizations
A secret API key. Publishable keys cannot reach this API. A key may carry an expiry, and an expired key is refused exactly like an unknown one, with a 401 that names no reason; check the key's expires_at in the dashboard rather than inferring it from a response. When a merchant rolls a key's secret they choose a grace window of up to 3 days, and for its duration BOTH the new secret and the one it replaced authenticate, so an integration moves over on its own deploy schedule instead of at the instant the button is pressed. Move before the window closes: after it, the old secret is refused. Nothing else about this contract moves with a roll. The key keeps its id and its scopes, so the only thing an integration updates is the credential itself.
Headers
A unique key per logical write. Replaying a request with the same key returns the first response byte for byte instead of applying the write twice.
Path Parameters
Body
Every value is an absolute target, so replaying converges. Sending a money field REDEFINES what the discount is worth immediately: the discount is evaluated at checkout time rather than snapshotted onto the cart, so a shopper already in checkout pays the new amount with no notification. Status is not settable here; use the enable and disable routes.
Required on create. The natural key a shopper types, and what makes a retry outside the idempotency window a 409 code_taken rather than a second discount. UPPER-CASED AND TRIMMED SERVER-SIDE, so "apitest-disc-001" is stored and returned as "APITEST-DISC-001": read the code back from the response rather than assuming the bytes you sent, and note that two codes differing only in case are the SAME code and the second is a 409.
Sets a percentage discount. Basis points, so 15% is 1500 and no rounding question arises. 1..10000. Mutually exclusive with amount_minor.
x >= 1Sets a fixed discount, in minor units of the store's base currency. Mutually exclusive with percentage_basis_points, and requires currency_code in the same object.
x >= 1Required with amount_minor and refused without it. An assertion rather than a choice: promotion has no currency column, so this must equal the store's base currency or the write is refused with 409 currency_mismatch.
Total redemptions allowed. Omit, or send null on a patch, for unlimited. Zero is refused rather than read as unlimited.
x >= 1Response
Success
