Add these variables to your .env.local file:
# Stripe Configuration
STRIPE_SECRET_KEY=sk_test_...
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...-
Create Products in Stripe Dashboard:
- Monthly Plan: $29/month
- Quarterly Plan: $79/3 months
- Semi-Annual Plan: $149/6 months
-
Set up Webhooks:
- Endpoint:
https://yourdomain.com/api/stripe/webhooks - Events:
customer.subscription.created,customer.subscription.updated,customer.subscription.deleted
- Endpoint:
-
Get API Keys:
- Secret Key: Dashboard → Developers → API Keys
- Publishable Key: Dashboard → Developers → API Keys
- Webhook Secret: Dashboard → Developers → Webhooks → Select endpoint → Signing secret
npm install stripe @stripe/stripe-js