💳 Stripe Integration Setup
Configure Stripe payments, create products, set up webhooks, and test checkout flow.
By Test Staff33 views
Stripe Integration Setup
Get API Keys
- Go to Stripe Dashboard
- Enable Test mode
- Go to Developers → API Keys
- Copy keys to
.env:
STRIPE_SECRET_KEY="sk_test_..."
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_..."
Create Products
Option A: Stripe Dashboard
- Products → Add Product
- Create pricing plans (e.g., $19/mo, $49/mo)
- Copy Price IDs
Option B: Included Script
npm run stripe:setup
Configure Webhooks
- Stripe Dashboard → Developers → Webhooks
- Add endpoint:
https://yourdomain.com/api/webhooks/stripe - Select events:
checkout.session.completedinvoice.payment_succeededcustomer.subscription.deleted
- Copy webhook secret:
STRIPE_WEBHOOK_SECRET="whsec_..."
Test Locally
stripe listen --forward-to localhost:3000/api/webhooks/stripe
Test Checkout
- Go to
/dashboard/upgrade - Click a plan
- Use test card:
4242 4242 4242 4242 - Check webhook logs
Troubleshooting
- Webhook not working? Verify secret matches
- Payment not processing? Check API keys
- Logs: Check
/admin/settings/stripefor errors
Need help? [email protected]
Was this article helpful?
Let us know so we can improve our docs