Documentation

Guides and references

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

  1. Go to Stripe DashboardDevelopersAPI keys
  2. Copy:
    • Publishable keyNEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
    • Secret keySTRIPE_SECRET_KEY
Stripe Developers → API keys

3. Create Products and Prices

  1. Go to ProductsAdd product

  2. Create three products: Standard, Pro, Ultra (or match your plan names)

  3. For each product, add:

    • Monthly price — Recurring, monthly
    • Annual price — Recurring, yearly (typically 20% discount)
  4. 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.

Stripe Products → Add product — product form

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.

Stripe CLI stripe listen and webhook forwarding

Production

  1. Go to DevelopersWebhooksAdd endpoint
  2. Endpoint URL: https://your-domain.com/api/webhooks/stripe
  3. Select events: checkout.session.completed, customer.subscription.updated, customer.subscription.deleted, invoice.paid, invoice.payment_failed
  4. Copy the signing secret to STRIPE_WEBHOOK_SECRET
Stripe Webhooks → Add endpoint — URL and events selection

5. Customer Portal (Optional)

For self-service subscription management (cancel, update payment):

  1. Go to SettingsBillingCustomer portal
  2. Configure branding and features
  3. NextBento uses /api/billing/portal to redirect users to the portal
Stripe Settings → Billing → Customer portal config

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