Skip to main content
POST
/
v1
/
stripe
/
checkout
Start checkout
curl --request POST \
  --url https://api.example.com/v1/stripe/checkout \
  --header 'Content-Type: application/json' \
  --data '
{
  "price_id": "<string>",
  "success_url": "<string>",
  "cancel_url": "<string>"
}
'
Server-side checkout creation. Returns a Stripe-hosted URL; the caller redirects the user there. Never expose the Stripe secret key to the browser, this endpoint exists precisely to keep it server-side.

Body

price_id
string
required
Stripe price id. Must be one of the prices configured on the server (see GET /v1/stripe/catalog). Hostile price ids are rejected with 400 invalid_args.
success_url
string
Where to send the user after a successful payment. Default: ${origin}/PaymentSuccess?session_id={CHECKOUT_SESSION_ID}.
cancel_url
string
Where to send the user if they bail out. Default: ${origin}/PaymentCancel.

Response

{
  "url":        "https://checkout.stripe.com/c/pay/cs_test_...",
  "session_id": "cs_test_...",
  "kind":       "credit_pack"
}
kind is either "subscription" or "credit_pack", useful when the UI wants to show different post-checkout messaging.

Errors

StatusCodeMeaning
401unauthenticatedMissing Authorization or X-Lavendly-User-Id.
400invalid_argsUnknown price_id (not in the server’s catalog).
502billing_upstreamStripe returned a non-2xx.
503billing_not_configuredSTRIPE_SECRET_KEY not set on this deploy.