Skip to content

Billing & Stripe

Stripe powers subscription billing from the dashboard Billing page.

  1. Create products and prices in the Stripe Dashboard
  2. Add keys to .env:
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_STARTER_PRICE_ID=price_...
STRIPE_PRO_PRICE_ID=price_...

Server actions on /app/billing create Stripe Checkout sessions. Successful checkouts are synced to the subscription table via webhooks.

Point Stripe to:

http://localhost:3000/app/api/webhooks/stripe

Use the Stripe CLI for local testing:

Terminal window
stripe listen --forward-to localhost:3000/app/api/webhooks/stripe

Users with an active subscription can open the Stripe Customer Portal from the billing page to manage payment methods and cancel plans.