This document provides instructions on how to set up the Stripe payment integration for the Susap AI Mock Interview platform.
- A Stripe account (you can sign up at stripe.com)
- Node.js and npm installed
- Access to your project's environment variables
If you don't already have a Stripe account, create one at stripe.com.
- Log in to your Stripe Dashboard
- Go to Developers > API keys
- Copy your Publishable key and Secret key
- Add them to your
.env.localfile:NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_your_publishable_key STRIPE_SECRET_KEY=sk_test_your_secret_key
- Go to Products in your Stripe Dashboard
- Create two products:
- Better Agent (₹399/month)
- Advance Agent (₹699/month)
- For each product, create a recurring price with the appropriate amount
- Copy the Price IDs and add them to your
.env.localfile:NEXT_PUBLIC_STRIPE_BETTER_AGENT_PRICE_ID=price_your_better_agent_price_id NEXT_PUBLIC_STRIPE_ADVANCE_AGENT_PRICE_ID=price_your_advance_agent_price_id
- Go to Developers > Webhooks in your Stripe Dashboard
- Click "Add endpoint"
- Enter your webhook URL:
https://your-domain.com/api/webhooks/stripe - Select the following events to listen for:
checkout.session.completedcustomer.subscription.updatedcustomer.subscription.deleted
- Click "Add endpoint"
- Copy the Webhook Signing Secret and add it to your
.env.localfile:STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
For local development, you can use the Stripe CLI to forward webhooks to your local environment:
- Install the Stripe CLI
- Run the following command:
stripe listen --forward-to localhost:3000/api/webhooks/stripe - The CLI will provide a webhook signing secret. Use this for local testing.
- Start your development server
- Navigate to the pricing page
- Click on a subscription plan
- You should be redirected to the Stripe Checkout page
- Use Stripe's test card numbers for testing:
4242 4242 4242 4242(successful payment)4000 0000 0000 9995(failed payment)
- Checkout not working: Verify your API keys and price IDs
- Webhooks not receiving events: Check your webhook URL and signing secret
- Payment processing errors: Check the Stripe Dashboard for error logs