CreateCheckoutSession
Source:
src/Stripe/CreateCheckoutSession.ts
Create a Stripe Checkout Session over HTTP. This is how a Worker starts
a purchase: create the session for a Price, then redirect the buyer to
session.url. Stripe hosts the payment page and sends
checkout.session.completed when it succeeds.
Account-scoped — binds the API key onto the host, not a specific resource.
Starting a subscription checkout
Section titled “Starting a subscription checkout”const createCheckout = yield* Stripe.CreateCheckoutSession();
// inside a Worker routeconst session = yield* createCheckout({ mode: "subscription", line_items: [{ price: price.id, quantity: 1 }], customer: customerId, success_url: `${origin}/welcome`, cancel_url: `${origin}/pricing`,});// redirect to session.url