Skip to content

CreateBillingPortalSession

Source: src/Stripe/CreateBillingPortalSession.ts

Create a Stripe Billing Portal Session over HTTP. The portal is Stripe’s hosted page where a customer updates their card, switches plans, downloads invoices, or cancels — so your app never has to build those screens. Create the session for the customer and redirect them to session.url.

Account-scoped — binds the API key onto the host, not a specific resource.

Letting a customer manage their subscription

Section titled “Letting a customer manage their subscription”
const createPortal = yield* Stripe.CreateBillingPortalSession();
// inside a Worker route
const session = yield* createPortal({
customer: customerId,
return_url: `${origin}/account`,
});
// redirect to session.url