Create a Stripe Checkout Session for a credit pack.
POST
/api/billing/checkout
const url = 'https://api.tradr.cloud/api/billing/checkout';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"packId":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.tradr.cloud/api/billing/checkout \ --header 'Content-Type: application/json' \ --data '{ "packId": "example" }'Authed and per-user rate limited (10 / 60 s). Body { packId } selects a server-authoritative CREDIT_PACKS pack — the price and credit grant come solely from config, never client input (REQ-2.2). Returns { url }, the Stripe-hosted checkout page to redirect to. NO wallet write happens here — crediting is the webhook’s job (REQ-2.6). When Stripe is unconfigured the endpoint returns a stable 402 BILLING_NOT_AVAILABLE (REQ-2.5/10.2).
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
packId
required
string
Examplegenerated
{ "packId": "example"}Responses
Section titled “Responses”{ url } — the Stripe-hosted checkout URL.
Validation error or UNKNOWN_PACK.
BILLING_NOT_AVAILABLE (Stripe unconfigured).
Checkout rate limit reached (10 / 60 s).