Apply a Code
POST /discounts/apply
Session: checkout. Rate limit: discount.apply. The body is the full cart plus code (required, up to 40 characters). Strapi prices the cart with the code added, and saves the cart with the code only when its status is APPLIED or AWAITING_SHIPPING.
Request
Response 200
quote is a full quote (shortened above). With an empty cart, every code answers CONDITIONS_NOT_MET, so the answer never reveals whether a code exists. To remove a code, send the cart without it to POST /cart/quote. A cart holds up to 5 codes (400 too_many on promotionCodes).
src/app/(store)/cart/actions.ts (continued)
Code Statuses
The same public statuses appear indiscounts/apply, in quote.codes[].status and in the detail of a PROMOTION_CODE_INVALID error.
Checkout Email Verification
Some codes need proof that the guest owns the email: Strapi never evaluates a per customer limit or an email list without it, so the API never tells whether an email already bought. The same proof lets a guest place an order with the email of a registered account. A logged in customer never needs it: the account email is already verified.1
Send the code
POST /checkout/email-verification with { "email": "jane@example.com", "locale": "en" }. Strapi emails a
6 digit code valid for 10 minutes and answers 202 { "expiresAt": "2026-11-27T10:10:00.000Z" }.2
Confirm the code
POST /checkout/email-verification/confirm with { "email": "jane@example.com", "code": "042317" }. Strapi
answers 200 { "verified": true } and marks the email verified on this guest session.3
Quote again with the email
Send the cart with
email: "jane@example.com". The code status now reflects the real eligibility. Use the same
email in customer.email when you place the order.409 ACTION_NOT_AVAILABLE. Rate limits: email.send and email.confirm.
Gifts (Buy X Get Y)
A “buy X, get a gift” promotion adds its gift by itself. Never put the gift in the cart yourself: a gift variant sent as a cart line is an ordinary purchase, charged in full.- Gift lines. When the promotion applies,
quote.lineshas a line withisGift: true, already discounted (total: 0for a free gift) and with the promotion inpromotionIds. It follows the cart: buy fewer and it goes away at the next quote. giftOptions. One entry per applied promotion with a gift.quantityis the units per gift andrepetitionsis how many gifts the cart earns (buy 4 with “buy 2, get 1” gives 2).selectedlists the variant of each gift, first to last.availabletells whether the variant has stock for a gift (the cart’s own units of that variant are already taken out).- Choosing. By default each gift is the first variant with stock. To choose, send
giftChoicesin the next quote (Strapi stores it in the cart), indiscounts/applyand in the order:{ "9": 42 }uses that variant for every gift of promotion 9,{ "9": [41, 42] }chooses gift by gift (1 to 20 ids). A missing position, a variant the promotion does not offer, or one without stock falls back to the default, soselectedalways shows what the customer gets. Show a choice only whenvariantshas more than one entry, and disable the variants withavailable: false. - Out of stock. When the cart meets the promotion but no gift variant has stock, there is no gift line and no
giftOptionsentry. The promotion shows inunavailableGifts: [{ promotionId, name, code }]so you can say “the gift is out of stock”. Other benefits of that promotion still apply.
giftOptions entry
Store Credit
A store credit is a 12 character code bound to an email. The customer can use it at checkout without verifying the email: the code itself is the secret.POST /store-credit/check
Session: checkout. Rate limit: storeCredit.check.
Request
Response 200
email. A credit of another email answers the same as an unknown code. Errors: 400 on code with STORE_CREDIT_NOT_FOUND, STORE_CREDIT_VOID, STORE_CREDIT_EXPIRED or STORE_CREDIT_EMPTY; 400 invalid_email on email.
To use it, send storeCreditCode with the order. Strapi pays min(balance, total) from the credit. The order answer’s due tells what is left to pay. When due is 0, there is nothing to pay on Stripe.