Steps
1
Create Stripe Account
Get your Stripe account ready:
- Go to stripe.com and sign up
- Complete account setup
- Switch to Test Mode (toggle top-right)
2
Get API Keys
Grab your credentials:
- Click Developers (top right)
- Click API keys
- You’ll see two keys:
- Publishable key (starts with
pk_test_) - Secret key (starts with
sk_test_- click “Reveal”)
- Publishable key (starts with
.env.local:.env.local
3
Create Products
Set up your pricing plans in Stripe:
- Go to Product catalog → Add product
- Fill in:
- Name: Basic Plan
- Description: What customers get
- Pricing: Choose “Recurring” for subscriptions, “One-off” for one-time payments
- Price: $29 (or your price)
- Click Save product
- Copy the Price ID (starts with
price_)- On the product page, under Pricing, click the ⋯ menu next to the price and select Copy Price ID.
Price IDs connect your buttons to Stripe products. Don’t lose them!
4
Add Price IDs to Config
Open Your pricing page will now show these plans automatically.
/config.ts:/config.ts
5
Set Up Webhooks
Webhooks tell your app when payments happen:
- In Stripe, search for Webhooks and select it
- Click Add Destination
- Click Select events and choose:
checkout.session.completedcheckout.session.expiredcustomer.subscription.updatedcustomer.subscription.deletedinvoice.paidinvoice.payment_failed
- Click Continue
- Destination type > Webhook endpoint
- Endpoint URL:
https://yourapp.com/api/stripe/webhook - Copy the Signing secret (starts with
whsec_)
Webhook logic lives in
/app/api/stripe/webhook/route.ts. Customize it for your needs.6
Test Local Webhooks
To test webhooks locally, install Stripe CLI:Copy the webhook signing secret and add to Keep this terminal running while testing.
Trigger events:
Terminal
.env.local:.env.local
Trigger events:
Terminal
7
Test a Payment
Time to see it work:
- Start dev server:
npm run dev - Start webhook forwarding (from Step 6)
- Go to
http://localhost:3000/#pricing - Click a “Get Started” button
- Use Stripe test card:
- Card:
4242 4242 4242 4242 - Expiry: Any future date (12/34)
- CVC: Any 3 digits (123)
- Card:
- Complete checkout
Success! Check:
- Stripe dashboard for the payment
- Supabase
profilestable forhas_access = true
8
Customer Portal
Users can manage subscriptions themselves:
- Cancel subscription
- Update payment method
- View invoices
- Download receipts
/dashboard/account 🎉Going Live
Ready to accept real payments?1
Complete Verification
Stripe needs to verify your business:
- Business details
- Bank account
- Identity verification
2
Switch to Live Mode
- Toggle to Live Mode in Stripe dashboard
- Get your live API keys (
pk_live_andsk_live_) - Create live products (same as test)
- Copy live Price IDs
3
Update Production
In Vercel/your host:Update
/config.ts with live Price IDs.4
Create Live Webhook
Same as Step 5, but in live mode:
- Endpoint:
https://yourapp.com/api/stripe/webhook - Same events
- Get new signing secret
Troubleshooting
Payment works but user doesn't get access?
Payment works but user doesn't get access?
Check these:
- Webhook events in Stripe dashboard (any errors?)
.env.localhas correct keys- Webhook secret is correct
- Supabase connection works
- Check logs -
/app/api/stripe/webhook/route.ts
Webhook not receiving events?
Webhook not receiving events?
- Check webhook URL is correct
- Verify endpoint is reachable (try
curl) - Look at webhook logs in Stripe dashboard
- For local testing, ensure
stripe listenis running
Customer portal not loading?
Customer portal not loading?
- Check
STRIPE_SECRET_KEYis set - User must have a
customer_idin database - Try logging in again to refresh session
