Guest Checkout and Access
Your customers can pay for lifetime access before creating an account. After Stripe confirms a guest payment, your app finds or creates the customer's account, saves the purchase and sends an account-setup email.
Customers can pay before signing up
Pricing cards send a lifetime tier to the same-origin API:
{ "tierId": "tier-individual" }With Stripe selected, resolves its approved
Price from your pricing configuration
and chooses payment mode. A guest is allowed for that lifetime offer;
recurring checkout requires sign-in. Approved Stripe Price ID requests remain
available through the API contract.
Stripe confirms the purchase
Returning to /checkout/success only confirms the browser journey. The webhook
verifies Stripe's signature before the event reaches billing logic, and the
Lifetime path responds to checkout.session.completed.
The handler uses the Checkout Session rather than a redirect parameter to find the Stripe Customer, purchased Price, and email collected by Stripe.
Your app finds or creates the customer's account
A signed-in purchase includes client_reference_id, so it stays attached to
the existing user. A guest purchase has no user reference; the handler finds or
creates a Supabase user from the Checkout email instead.
The same email therefore reconnects a returning Supabase user instead of silently creating a second account.
Your app saves lifetime access
For a one-time payment, the handler stores the approved Price ID and Stripe event time against the resolved user and Stripe Customer.
if (session.mode === 'payment') {
await BillingRepository.upsertCustomer({
userId: checkoutUser.userId,
stripeCustomerId: customerId,
priceId,
purchasedAt: eventCreated ? toDateTime(eventCreated) : new Date(),
});
}The approved Price and purchase date establish the Stripe lifetime grant. combines that persisted purchase with eligible subscriptions for account status and protected access. Your protected routes read that state rather than calling Stripe during each authorization check.
Guests receive an account-setup email
The handler generates a Supabase recovery link for password setup and stores the onboarding delivery by Checkout Session before sending it.
Stripe may deliver the same event again. The persisted delivery record and idempotency key let the app reuse completed onboarding work instead of sending another setup journey.
The success page gives the next action
A guest sees that payment completed and is told to check their setup email. The email finishes account setup; the stored purchase establishes paid access.
Test guest checkout locally
Keep your local app, Supabase and matching Stripe listener
running in Stripe test mode. Complete the approved lifetime Price and customer
portal setup, then follow the capture prerequisites in
Test Lifetime Billing.
The app and runner need EMAIL_DELIVERY_MODE=test_capture and the same private,
server/local-only TEST_EMAIL_CAPTURE_TOKEN; restart the app after changing it.
Run the existing local lifetime suite from your cloned app root:
./coremvp e2e billing:lifetimeThe suite covers a signed-in purchase and a fresh guest purchase. The guest case pays before signup, consumes its correlated captured setup link, sets a password and verifies stored lifetime access, Billing, the owned Stripe portal, protected HTML and Markdown, and denial after signout. A signed-in payment alone does not prove guest account setup.
Expect both buyer cases to pass with exit code 0. Capture keeps setup links
out of terminal output and sends no Resend email. A local pass does not prove a
hosted deployment, live charge or real inbox delivery. Use the lifetime testing
guide for complete prerequisites and failures.
Test guest checkout on your deployed app
The hosted journey uses Stripe test mode, starts without a session, completes password setup, and verifies authenticated lifetime access:
export TEST_BASE_URL=https://.vercel.app
./coremvp prod e2e billing:lifetimeUse Test Lifetime Billing for the required email-capture configuration, expected result, and proof limits.
What's next
Test Lifetime Billing
Billing Webhooks
Was this page helpful?