October 21, 2025
O. Wolfson
Ready to teach yourself (or your team) how to combine Supabase authentication with Stripe Checkout in a modern Next.js application? This guide walks through cloning and running:
| Feature | Details |
|---|---|
| Auth | Supabase email/password login with server-verified sessions |
| Payments | Stripe Checkout: one-time and subscription |
| Modes | Toggle between test and live Stripe keys |
| Security | Prices resolved server-side, session binding, metadata checks |
| Dashboard | View and cancel subscriptions per environment |
| Concern | Implementation |
|---|---|
| Framework | Next.js 15 (App Router, TypeScript) |
| Auth | Supabase |
| Payments | Stripe Checkout Sessions + Subscription APIs |
| Styling | Tailwind CSS |
| Deployment | Optimized for Vercel |
| Source | github.com/owolfdev/stripe-live |
bashgit clone https://github.com/owolfdev/stripe-live.git
cd stripe-live
npm install
Main branch contains the production-ready demo used at stripe-live.vercel.app.
In Supabase Dashboard → Auth → Settings:
Enable Email/Password sign-in.
Add redirect URLs for dev and production:
http://localhost:3000https://stripe-live.vercel.appExtract credentials:
SUPABASE_URL
SUPABASE_ANON_KEY
SUPABASE_SERVICE_ROLE_KEY
Product: Stripe Demo App Product
Prices:
basic, standard, premium (monthly)donateMirror these in test and live mode.
Assign lookup keys like:
stripe-live:subscription:basic
json{
"app": "stripe-live",
"store": "default",
"tier": "basic",
"billing_type": "subscription",
"environment": "test"
}
Copy all price_... values for both test and live into your environment variables.
.env.localAt the project root:
env# Supabase NEXT_PUBLIC_SUPABASE_URL=... NEXT_PUBLIC_SUPABASE_ANON_KEY=... SUPABASE_SERVICE_ROLE_KEY=... # Stripe (test) NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=... STRIPE_SECRET_KEY=... # Stripe (live) NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY_LIVE=... STRIPE_SECRET_KEY_LIVE=... # Stripe price IDs – test mode STRIPE_TEST_PRICE_DONATE=... STRIPE_TEST_PRICE_SUB_BASIC=... STRIPE_TEST_PRICE_SUB_STANDARD=... STRIPE_TEST_PRICE_SUB_PREMIUM=... # Stripe price IDs – live mode STRIPE_LIVE_PRICE_DONATE=... STRIPE_LIVE_PRICE_SUB_BASIC=... STRIPE_LIVE_PRICE_SUB_STANDARD=... STRIPE_LIVE_PRICE_SUB_PREMIUM=... # Optional NEXT_PUBLIC_SITE_URL=http://localhost:3000
🔐 Never commit
.env.local.
Restart the server after updating env vars.
bashnpm run dev
Visit:
Sign up via email/password to create a Supabase session.
Subscription listing/cancellation endpoints:
Deploy to Vercel:
bashvercel
Set all environment variables in Vercel project settings:
Different values for:
Reference implementation:
➡️ https://stripe-live.vercel.app
Happy hacking and safe deployments!