POST /checkout
/api/store/[slug]/checkoutCreates a Stripe Checkout session for the cart (one-time or subscription products), with optional coupon, gift card, service charges, and sale-price handling, then returns the hosted payment URL.
Path parameters
slugstringrequiredBusiness (store) slug used to resolve the tenant
Body parameters
itemsarrayrequiredCart lines; array of objects { variant_id: UUID string, quantity: positive integer }. At least 1 item required.
shipping_optionenumoptionalShipping choice; only applied when the cart contains physical products. flat_rate adds the business's flat shipping fee as a line item.
One of pickup, flat_rate
success_urlstringrequiredValid http(s) URL Stripe redirects to after successful payment (normalized/truncated if over 1800 chars).
cancel_urlstringrequiredValid http(s) URL Stripe redirects to if the customer cancels.
service_chargesarrayoptionalOptional add-on charges; array of objects { service_charge_id: UUID, variant_id: UUID, quantity: positive integer }. Each charge must belong to the business and be associated with the variant's product.
pickup_datestringoptionalPickup date in YYYY-MM-DD format. Only valid when shipping_option is 'pickup' (schema refine rejects otherwise).
coupon_codestringoptionalCoupon code, 1-20 chars, pattern ^[a-zA-Z0-9-]+$ (dashes allowed for generated codes). Re-validated server-side; cannot be combined with gift_card_code.
gift_card_codestringoptionalGift card code, 1-32 chars, pattern ^[a-zA-Z0-9\s-]+$ (16 alphanumeric chars, dashes/spaces allowed). Not combinable with coupon_code or subscription products; at least $0.50 stays payable.
customer_emailstringoptionalGuest email capture (valid email, max 254 chars). Used to prefill Stripe checkout and enable abandoned-checkout recovery; ignored when a customer is authenticated.
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.
A service this endpoint depends on is unavailable, usually Stripe.
What comes back
200 with { session_url, session_id } (Stripe hosted checkout URL and session ID). Errors return { error, details? } with 400/404/500/502/503. The 429 body differs from the rest: { success: false, error, retryAfter }. CORS-enabled (Access-Control-Allow-Origin: *); OPTIONS preflight supported.