Start a Stripe Checkout session
const url = 'https://api.sloose.com/billing/checkout';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"kind":"plan","planKey":"free","interval":"month","packKey":"example","quantity":1,"successUrl":"example","cancelUrl":"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.sloose.com/billing/checkout \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "kind": "plan", "planKey": "free", "interval": "month", "packKey": "example", "quantity": 1, "successUrl": "example", "cancelUrl": "example" }'For a plan subscription or a one-off credit pack. Enterprise does not self-serve: it answers { kind: "invoice" } and the subscription is billed by invoice instead.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
With kind: plan. One of team, business or enterprise.
With kind: plan. Defaults to month.
With kind: credit_pack.
With kind: credit_pack. Defaults to 1.
Responses
Section titled “Responses”A Checkout URL, or an invoice-billed subscription for Enterprise.
kind is missing, or the plan or pack key is not one we sell.
object
Examplegenerated
{ "error": "example"}No bearer, or one that is expired, revoked or no longer resolves to a member.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}The bearer’s role is too low, or it was issued for a different org.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}This org is a sandbox. Billing is managed on its production org.
object
Example
{ "code": "SANDBOX_ORG"}Stripe is not configured on this deployment.
object
Examplegenerated
{ "error": "example"}