Edit an existing coupon (code promo)
REPLACES the terms of one existing coupon addressed by the path id (server-minted; resolve it through GET /v1/coupons — the code is what customers type, the id is what this takes). The body is the SAME shape as create: it overwrites code, discount, the validity window, maxRedemptions and minBasketCents wholesale — a field you omit is not preserved, it is replaced by the schema’s value, so send the COMPLETE intended terms, not a partial patch. The path id is authoritative and the coupon’s own id never changes; there is no id in the body to retarget. Editing does NOT reset the redemption ledger: the returned view keeps the live redemptionCount, and a lowered maxRedemptions can already be at or below the count (the cap is enforced at redemption, not here). Only ACTIVE coupons are editable — a deactivated coupon is terminal and 404s, exactly as it reads back everywhere else. 404s when no active coupon bears the id.
Authorizations
Authorization: Bearer <token>. Accepts EITHER a Keycloak access token (scopes-in-token) OR an opaque POS session token; both resolve to the same pos.* scope vocabulary the route guards enforce.
Path Parameters
The server-minted coupon id to act on (not the customer-facing code).
1Body
1- Option 1
- Option 2
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$0 < x <= 90071992547409910 <= x <= 9007199254740991Response
The edited coupon, still active, with its unchanged id and ledger count.
The edited coupon, still active, with its unchanged id and ledger count.
11- Option 1
- Option 2
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$0 < x <= 90071992547409910 <= x <= 90071992547409910 <= x <= 9007199254740991
