Skip to main content
Automatic promotions apply by themselves on every quote. Discount codes need the customer to type them.

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 in discounts/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.
Session: guest only. With a login session both routes answer 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.lines has a line with isGift: true, already discounted (total: 0 for a free gift) and with the promotion in promotionIds. It follows the cart: buy fewer and it goes away at the next quote.
  • giftOptions. One entry per applied promotion with a gift. quantity is the units per gift and repetitions is how many gifts the cart earns (buy 4 with “buy 2, get 1” gives 2). selected lists the variant of each gift, first to last. available tells 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 giftChoices in the next quote (Strapi stores it in the cart), in discounts/apply and 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, so selected always shows what the customer gets. Show a choice only when variants has more than one entry, and disable the variants with available: false.
  • Out of stock. When the cart meets the promotion but no gift variant has stock, there is no gift line and no giftOptions entry. The promotion shows in unavailableGifts: [{ 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
For a logged in customer, Strapi checks the code against the account email and ignores 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.