POST /coupons/validate
/api/store/[slug]/coupons/validateValidates a coupon code against the cart contents and customer email, returning the discount amount and eligible items without applying anything.
Path parameters
slugstringrequiredBusiness (store) slug; coupons are scoped to the business, so cross-tenant codes look identical to non-existent codes
Body parameters
codestringrequiredCoupon code, max 20 chars, pattern ^[a-zA-Z0-9]+$ (no dashes accepted on this endpoint).
customer_emailstringrequiredCustomer's email (valid email) used for per-customer and first-time-only limit checks.
itemsarrayrequiredCart lines; array (min 0) of objects { product_id: UUID, variant_id: UUID, price: positive number, quantity: positive integer }.
Responses
The request succeeded.
A field failed validation. The response names the fields that failed, not just the first.
No such store, or no such record inside it.
Too many requests. Back off and retry after the window in the response.
Something failed on our side. The response carries no detail; retry is safe on a GET.
What comes back
Always 200 for business-level results: valid coupon returns { valid: true, discount_amount, eligible_item_ids, adjusted_total, coupon_id }; invalid returns { valid: false, error, minimum_required?, eligible_subtotal? }. HTTP 400/404/429/500 only for malformed requests, unknown store, rate limiting, or server errors. CORS-enabled; OPTIONS preflight supported.