POST /subscriptions
/api/store/[slug]/subscriptionsCreates a Stripe Checkout session in subscription mode for a product variant on behalf of the signed-in customer, returning the hosted checkout URL.
Path parameters
slugstringrequiredBusiness store slug (non-empty string); 404 if no business matches.
Body parameters
variant_idstringrequiredUUID of the product variant to subscribe to.
success_urlstringrequiredAbsolute URL to redirect to after successful checkout (validated as URL).
cancel_urlstringrequiredAbsolute URL to redirect to if the customer cancels checkout (validated as URL).
Responses
The request succeeded.
A field failed validation. The response names the fields that failed, not just the first.
The key or customer token is missing, malformed, or no longer valid.
The credential is valid but is not allowed to do this.
No such store, or no such record inside it.
What comes back
200: { session_url, session_id } for the Stripe Checkout session. Errors: { error, details? } with 400 (validation, business Stripe account not configured, or customer missing Stripe ID), 401 (missing/invalid token), 403 (token belongs to another business), 404 (business not found, or no billing customer matches the session email for this business). success_url and cancel_url are sanitized beyond URL validation: a non-http(s) value is rejected 400 with details path always 'success_url' (even when cancel_url is the offending one), fragments are stripped, and URLs over 1800 chars are progressively shortened (query dropped first, then path).