Create one coupon under a chosen code (code promo)
Mints ONE promo code with the exact code string you choose — use this for a named, shareable code (SAVE10, BLACKFRIDAY); use POST /v1/coupons/batch when you need many unguessable one-per-customer codes instead. The id is server-minted and returned; the code is what the customer presents. discount is either {type:'percentage', rateBps} in BASIS POINTS (1000 = 10%) or {type:'fixed', amountCents} in integer CENTS. maxRedemptions caps total uses across all baskets (1 = single-use), minBasketCents is the floor a basket must reach, and the ISO validFrom/validUntil window is inclusive. NOT idempotent and NOT unique on code (solya-pos#944): the id is minted server-side per call, so retrying a request whose response you missed creates a SECOND coupon sharing the same customer-facing code, and the till’s code-to-coupon lookup then resolves ambiguously between them. There is no 409 to protect you. Retry only after confirming through GET /v1/coupons that the first attempt did not land. Creating a code does NOT apply it to anything: it becomes redeemable, and checkout is what consumes a redemption.
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.
Body
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 created coupon, active with a zero redemption count.
The created coupon, active with a zero redemption 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
