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

1

Sign up or log in to your Razorpay dashboard at dashboard.razorpay.com.

2

Go to Settings → API Keys. Copy your Key ID and Key Secret.

3

Set 'Enable Live Payments' for production or keep it off for test mode.

4

In WAutoAI backend, set the environment variables: RAZORPAY_KEY_ID and RAZORPAY_KEY_SECRET.

5

Go to Razorpay → Plans → Create Plan. Create plans for Starter (₹650/mo), Pro (₹1,999/mo), and Enterprise (₹4,999/mo).

6

Copy each Plan ID from Razorpay and set them as environment variables: RAZORPAY_PLAN_STARTER, RAZORPAY_PLAN_PRO, RAZORPAY_PLAN_ENTERPRISE.

7

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.

8

Copy the webhook secret and set RAZORPAY_WEBHOOK_SECRET in your backend environment variables.

Environment Variables

VariableDescriptionRequired
RAZORPAY_KEY_IDYour Razorpay API Key IDYes
RAZORPAY_KEY_SECRETYour Razorpay API Key SecretYes
RAZORPAY_PLAN_STARTERPlan ID for Starter tierYes
RAZORPAY_PLAN_PROPlan ID for Pro tierYes
RAZORPAY_PLAN_ENTERPRISEPlan ID for Enterprise tierYes
RAZORPAY_WEBHOOK_SECRETSecret for webhook signature verificationYes

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.