Skip to content

Legacy Checkout Start

Create a provider checkout session for a logged-in user.

Legacy (v1) API. This page describes the Stripe-first legacy API. It stays supported for existing integrations but is frozen: new features ship only in v2. Prefer v2 for new work: v2 checkout reference.

POST /api/billstack/teams/{teamId}/projects/{projectId}/checkout/start

Auth

Private API key.

Body

FieldRequiredDescription
externalIdYesYour app user ID
email or phoneYesCustomer contact
nameNoCustomer display name
tierYespro, growth, or lifetime
cycleYesmonthly, annual, yearly, or once
providerNostripe or razorpay
referralCodeNoReferral code to attach
successUrlYesRedirect after successful checkout
cancelUrlYesRedirect after checkout cancellation

Response

Returns 201 Created.

{
  "checkoutUrl": "https://checkout.stripe.com/c/pay/...",
  "customerId": "pc_...",
  "provider": "stripe",
  "intentId": "cs_..."
}

Errors

StatusMeaning
400A required field is missing (externalId, email/phone, tier, cycle, successUrl, or cancelUrl)
400Business error from checkout, e.g. an invalid referralCode a provider that differs from the default region's provider, a team with no payment provider, or an unconfigured/misconfigured Razorpay account on a Razorpay default region
409REGION_REQUIRES_V2: the customer is pinned to a non-default region; use the v2 checkout
403Missing or invalid auth

Notes

  • Use logged-in checkout for referral attribution.
  • Use externalId consistently across checkout, entitlements, portal sessions, and referrals.
  • This v1 checkout serves the team's default region only, so it always uses the default payment provider (Stripe or Razorpay) and never takes a country. provider is optional and, when sent, must match the default region's provider; otherwise the request fails with a 400 (PAYMENT_PROVIDER_CONFLICT). phone is never used to pick a provider, and checkout never falls back to another provider. A team with no payment provider, or a default region on Razorpay whose project Razorpay config is missing or inactive, also fails with a 400. A customer pinned to a non-default region gets 409 REGION_REQUIRES_V2; regions and country routing are v2 only (see Multi-provider v2).

If you already hold an internal BillStack customerId and priceId (rather than your app's external IDs), use POST /api/billstack/teams/{teamId}/projects/{projectId}/checkout instead. It takes { customerId, priceId, quantity?, successUrl, cancelUrl, mode?, trialDays?, metadata? } and requires project admin access (session) or an API key.