Getting Started
Stripe Setup
Configure Stripe for subscription billing in NextBento.
1. Create a Stripe Account
Sign up at stripe.com. Use Test mode (toggle in dashboard) for development.
2. Get API Keys
- Go to Stripe Dashboard → Developers → API keys
- Copy:
- Publishable key →
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY - Secret key →
STRIPE_SECRET_KEY
- Publishable key →
3. Create Products and Prices
-
Go to Products → Add product
-
Create three products: Standard, Pro, Ultra (or match your plan names)
-
For each product, add:
- Monthly price — Recurring, monthly
- Annual price — Recurring, yearly (typically 20% discount)
-
Copy the Price IDs (e.g.
price_xxx) and add to.env.local:
STRIPE_PRICE_STANDARD_MONTHLY=price_xxx
STRIPE_PRICE_STANDARD_ANNUAL=price_xxx
STRIPE_PRICE_PRO_MONTHLY=price_xxx
STRIPE_PRICE_PRO_ANNUAL=price_xxx
STRIPE_PRICE_ULTRA_MONTHLY=price_xxx
STRIPE_PRICE_ULTRA_ANNUAL=price_xxx
See lib/config/env.ts for the exact variable names.
4. Webhook Setup
Local Development
Use the Stripe CLI to forward webhooks:
stripe listen --forward-to localhost:3000/api/webhooks/stripe
Copy the webhook signing secret (e.g. whsec_xxx) to STRIPE_WEBHOOK_SECRET.
Production
- Go to Developers → Webhooks → Add endpoint
- Endpoint URL:
https://your-domain.com/api/webhooks/stripe - Select events:
checkout.session.completed,customer.subscription.updated,customer.subscription.deleted,invoice.paid,invoice.payment_failed - Copy the signing secret to
STRIPE_WEBHOOK_SECRET
5. Customer Portal (Optional)
For self-service subscription management (cancel, update payment):
- Go to Settings → Billing → Customer portal
- Configure branding and features
- NextBento uses
/api/billing/portalto redirect users to the portal
6. Environment Variables
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_xxx
STRIPE_SECRET_KEY=sk_test_xxx
STRIPE_WEBHOOK_SECRET=whsec_xxx
# Plus the 6 price IDs above
Test Mode
Note
Use test card 4242 4242 4242 4242 for successful payments. See Stripe test cards for more test cards and scenarios.
Next Steps
- Billing — Plans, checkout flow, webhooks
- Environment Variables — Full reference