Stripe.Checkout reference
CreateCheckoutSession
Section titled “CreateCheckoutSession”Source:
packages/stripe/src/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.
CreateCheckoutSession: Starting a subscription checkout
Section titled “CreateCheckoutSession: 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.urlCreateCheckoutSessionHttp
Section titled “CreateCheckoutSessionHttp”Source:
packages/stripe/src/CreateCheckoutSessionHttp.tsKind: Layer · Provides:Stripe.CreateCheckoutSession
HTTP implementation of CreateCheckoutSession. Provide it on the
Function or Worker Effect.
PaymentLink
Section titled “PaymentLink”Source:
packages/stripe/src/PaymentLink.ts
A Stripe Payment Link — a shareable URL that opens a hosted Checkout
page. Requires at least one lineItems price. Quantity, metadata,
active, and most Checkout options update in place; changing the set
of prices, currency, managedPayments, subscriptionData.description,
or paymentIntentData.captureMethod replaces the link, which gives it a
new URL. Options left out keep their current value. Payment links
cannot be deleted; destroy deactivates them (active=false).
PaymentLink: Creating a Payment Link
Section titled “PaymentLink: Creating a Payment Link”One-time price
const product = yield* Stripe.Product("pro-plan", { name: "Pro Plan" });const price = yield* Stripe.Price("pro-once", { product: product.id, currency: "usd", unitAmount: 2000,});const link = yield* Stripe.PaymentLink("buy", { lineItems: [{ price: price.id, quantity: 1 }],});Promotion codes and a confirmation message
const link = yield* Stripe.PaymentLink("buy", { lineItems: [{ price: price.id, quantity: 1 }], allowPromotionCodes: true, afterCompletion: { type: "hosted_confirmation", hostedConfirmation: { customMessage: "Thanks for your order." }, }, metadata: { campaign: "launch" },});PaymentLink: Checkout options
Section titled “PaymentLink: Checkout options”Shipping, custom fields, and a session limit
const ground = yield* Stripe.ShippingRate("ground", { displayName: "Ground", amount: 500, currency: "usd",});const link = yield* Stripe.PaymentLink("buy", { lineItems: [{ price: price.id, quantity: 1 }], shippingAddressCollection: { allowedCountries: ["US", "CA"] }, shippingOptions: [{ shippingRate: ground.id }], customFields: [{ key: "company", label: "Company", type: "text", optional: true }], customText: { submit: "We ship within two days." }, taxIdCollection: { enabled: true }, restrictions: { completedSessions: { limit: 100 } },});Subscription with a free trial
const link = yield* Stripe.PaymentLink("subscribe", { lineItems: [{ price: monthly.id, quantity: 1 }], subscriptionData: { trialPeriodDays: 14, trialSettings: { endBehavior: { missingPaymentMethod: "cancel" } }, metadata: { plan: "pro" }, },});Post-payment invoice and an optional add-on
const link = yield* Stripe.PaymentLink("buy", { lineItems: [{ price: price.id, quantity: 1 }], optionalItems: [{ price: addOn.id, quantity: 1 }], invoiceCreation: { enabled: true, invoiceData: { footer: "Thanks!" } },});PaymentLink: Updating a Payment Link
Section titled “PaymentLink: Updating a Payment Link”const link = yield* Stripe.PaymentLink("buy", { lineItems: [{ price: price.id, quantity: 2 }], active: false, inactiveMessage: "This link is no longer available.", metadata: { campaign: "paused" },});PaymentLink: Looking up an existing payment link
Section titled “PaymentLink: Looking up an existing payment link”PaymentLink.lookup references a payment link Alchemy doesn’t manage (created in
the Stripe Dashboard or by another stack). It is read during plan/deploy,
never created, updated or deleted.
const ref = Stripe.PaymentLink.lookup({ id: "plink_1A2b3C4d5E6f7G8h" });RetrievePaymentLink
Section titled “RetrievePaymentLink”Source:
packages/stripe/src/RetrievePaymentLink.ts
Retrieve a bound Stripe Payment Link over HTTP.
RetrievePaymentLink: Reading a Payment Link
Section titled “RetrievePaymentLink: Reading a Payment Link”const retrieve = yield* Stripe.RetrievePaymentLink(checkout);const live = yield* retrieve();RetrievePaymentLinkHttp
Section titled “RetrievePaymentLinkHttp”Source:
packages/stripe/src/RetrievePaymentLinkHttp.tsKind: Layer · Provides:Stripe.RetrievePaymentLink
HTTP implementation of RetrievePaymentLink. Provide it on the
Function or Worker Effect.