Razorpay Subscription Setup — Accept Payments
6 min read
Quick Summary
WAutoAI uses Razorpay for payment processing in INR. Razorpay handles subscriptions, recurring billing, and payment receipts. This guide walks you through setting up Razorpay from scratch — creating plans, configuring webhooks, and connecting to your backend.
Step-by-Step Guide
Sign up or log in to your Razorpay dashboard at dashboard.razorpay.com.
Go to Settings → API Keys. Copy your Key ID and Key Secret.
Set 'Enable Live Payments' for production or keep it off for test mode.
In WAutoAI backend, set the environment variables: RAZORPAY_KEY_ID and RAZORPAY_KEY_SECRET.
Go to Razorpay → Plans → Create Plan. Create plans for Starter (₹650/mo), Pro (₹1,999/mo), and Enterprise (₹4,999/mo).
Copy each Plan ID from Razorpay and set them as environment variables: RAZORPAY_PLAN_STARTER, RAZORPAY_PLAN_PRO, RAZORPAY_PLAN_ENTERPRISE.
Set up the Webhook: Go to Settings → Webhooks → Add Webhook. Enter your backend URL + /api/razorpay/webhook. Select events: subscription.activated, subscription.charged, subscription.halted, subscription.cancelled.
Copy the webhook secret and set RAZORPAY_WEBHOOK_SECRET in your backend environment variables.
Environment Variables
| Variable | Description | Required |
|---|---|---|
| RAZORPAY_KEY_ID | Your Razorpay API Key ID | Yes |
| RAZORPAY_KEY_SECRET | Your Razorpay API Key Secret | Yes |
| RAZORPAY_PLAN_STARTER | Plan ID for Starter tier | Yes |
| RAZORPAY_PLAN_PRO | Plan ID for Pro tier | Yes |
| RAZORPAY_PLAN_ENTERPRISE | Plan ID for Enterprise tier | Yes |
| RAZORPAY_WEBHOOK_SECRET | Secret for webhook signature verification | Yes |
Troubleshooting
Webhook not being called
Make sure your backend URL is publicly accessible and the webhook URL is correct (e.g., https://your-backend.com/api/razorpay/webhook). Check that the webhook is enabled in Razorpay dashboard and the correct events are selected.
"Invalid signature" webhook error
The RAZORPAY_WEBHOOK_SECRET in your backend must match exactly with the webhook secret configured in Razorpay dashboard. Copy it again from Razorpay Settings → Webhooks → your webhook → Secret.