Cloud Stack for AI Apps — Mastery4 / 8
Stripe — Payments & Subscriptions
Charging money is a solved problem — if you let Stripe solve it. Checkout, subscriptions, and the webhook that is the real source of truth.

Do not build a payment form. Stripe's hosted Checkout handles cards, wallets, taxes, SCA, and fraud — you redirect to it and get a result. Your job is wiring, not cryptography.
Checkout in one call
Create a Checkout Session server-side with a price id and success/cancel URLs; redirect the user. One-time products and recurring subscriptions are the same flow with a different mode (payment vs subscription).
const session = await stripe.checkout.sessions.create({
mode: 'subscription',
line_items: [{ price: priceId, quantity: 1 }],
success_url: `${APP}/success?session_id={CHECKOUT_SESSION_ID}`,
cancel_url: `${APP}/pricing?canceled=1`,
})
The webhook is the source of truth
The redirect is for UX (a thank-you page); the webhook is for truth (provision the account, send the email, flip the entitlement).
Subscriptions need lifecycle handling
Handle the recurring events: invoice.paid (extend access), customer.subscription.deleted / updated (revoke or change tier), failed payments (dunning). Access should follow Stripe's state, not a one-time flag.
Next: the email that confirms the purchase — Resend.
Series — Cloud Stack for AI Apps — Mastery
- Part 01The Opinionated AI Product StackChoosing infrastructure is where weeks vanish. Here is a default stack that lets a small team ship an AI product in days — and when to deviate.
- Part 02Next.js on Vercel — The App LayerOne framework for UI, API and server rendering; one platform that deploys on git push. The app layer should be the part you never think about.
- Part 03Supabase — Postgres, Auth & Storage in OneReal Postgres, auth, file storage and pgvector behind one SDK. For an AI product, having your data and your vectors in the same database is a quiet superpower.
- Part 04Stripe — Payments & Subscriptions — you are hereCharging money is a solved problem — if you let Stripe solve it. Checkout, subscriptions, and the webhook that is the real source of truth.
- Part 05Resend — Transactional Email That LandsThe receipt, the download link, the password reset — if they hit spam, your product feels broken. Deliverability is a feature.
- Part 06AWS — When You Outgrow the Managed PathThe managed stack covers 90% of an AI product. AWS is the escape hatch for the other 10% — long jobs, GPU inference, large files. Use it surgically.
- Part 07Secrets, Env & Config Across EnvironmentsFive services, three environments, one leaked key away from a bad week. Config discipline is unglamorous and non-negotiable.
- Part 08Shipping in Days — The Wiring PlaybookThe whole stack assembled into a build order: from empty repo to a paid, emailing, AI-powered product in a working week.