Skip to content
Connect an agent
Billing

Read a finished checkout back

Asks Stripe for the checkout session and its subscription and stores the same state the webhook stores.

POST/user/billing/verify-checkout

TL;DR

QuestionAnswer
What does it do?Read a finished checkout back.
What does it take?A JSON body of type VerifyCheckoutBody.
What does it return?Status 200 with a body of type BillingState.
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; 404 no such checkout session for this account; 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

Asks Stripe for the checkout session and its subscription and stores the same state the webhook stores. A session that is not this account's, or does not exist, is a 404 either way.

Request body

The body has the type VerifyCheckoutBody.

FieldTypeRequiredDescription
sessionIdstringyesThe Checkout Session id Stripe put in the return address. pattern ^cs_[A-Za-z0-9_]{8,200}$.

Responses

StatusMeaningBody
200The account's plan after the check.BillingState
400The body is not valid.ErrorResponse
401Not signed in.ErrorResponse
403The request came from an origin that may not make changes.ErrorResponse
404No such checkout session for this account.ErrorResponse
429Too many requests.ErrorResponse
502Stripe could not complete the request.ErrorResponse
503Billing is not set up on this server.ErrorResponse

Response body

A 200 answer has the type BillingState.

FieldTypeRequiredDescription
plan"free" | "pro"yesThe plan the account gets right now. It is the free plan whenever the subscription is not paying, whatever plan was bought.
statusstringyesStripe's status for the subscription (active, trialing, past_due, canceled, unpaid, incomplete, and so on), or none when the account never started one.
currentPeriodEndinteger | nullyesWhen the period paid for ends, in milliseconds since the epoch, or null when there is no subscription.
cancelAtPeriodEndbooleanyesTrue while the subscription is scheduled to end at the close of the period already paid for.
hasCustomerbooleanyesTrue once the account has billing details at Stripe, which is when the billing portal can be opened.

See also

DocWhy
API referenceEvery endpoint, and the error envelope
SchemasEvery request and response type
Tool referenceThe operations as callable tools