Billing
Start a checkout for a paid plan
Makes a Stripe Checkout Session for the plan and returns the address of Stripe's hosted page.
POST
/user/billing/checkoutTL;DR
| Question | Answer |
|---|---|
| What does it do? | Start a checkout for a paid plan. |
| What does it take? | A JSON body of type CheckoutBody. |
| What does it return? | Status 200 with a body of type BillingUrl. |
| What can go wrong? | 400 the body is not valid; 401 not signed in; 403 the request came from an origin that may not make changes; 409 the account is already on a paid plan; 429 too many requests; 502 stripe could not complete the request; 503 billing is not set up on this server. Every failure uses the one error envelope. |
What it does
Makes a Stripe Checkout Session for the plan and returns the address of Stripe's hosted page. An account already on a paid plan is refused with 409; the billing portal changes or ends the plan it has.
Request body
The body has the type CheckoutBody.
| Field | Type | Required | Description |
|---|---|---|---|
plan | "pro" | yes | The plan to subscribe to. pro is the only paid plan. |
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | The address of the Stripe page. | BillingUrl |
| 400 | The body is not valid. | ErrorResponse |
| 401 | Not signed in. | ErrorResponse |
| 403 | The request came from an origin that may not make changes. | ErrorResponse |
| 409 | The account is already on a paid plan. | ErrorResponse |
| 429 | Too many requests. | ErrorResponse |
| 502 | Stripe could not complete the request. | ErrorResponse |
| 503 | Billing is not set up on this server. | ErrorResponse |
Response body
A 200 answer has the type BillingUrl.
| Field | Type | Required | Description |
|---|---|---|---|
url | string | yes | An address on Stripe's own site. Send the browser there; it expires, so do not store it. |
See also
| Doc | Why |
|---|---|
| API reference | Every endpoint, and the error envelope |
| Schemas | Every request and response type |
| Tool reference | The operations as callable tools |