Razorpay
Overview
Razorpay is a payment gateway that enables businesses in India to accept, process, and disburse payments online. This guide walks you through integrating Razorpay into your Emergent application to accept payments from customers.
Note
Razorpay is primarily designed for businesses operating in India. Ensure your business is eligible and complies with Razorpay's registration requirements before integrating.
Prerequisites
Before you begin, you'll need:
- A Razorpay account (sign up here)
- Your Razorpay API Key and API Secret from the Razorpay Dashboard
- Basic understanding of payment flows (checkout, webhooks, order verification)
Getting Your Razorpay Credentials
Log into Razorpay Dashboard
Sign in to your Razorpay Dashboard.
Access API Keys
Go to Settings → API Keys.
Generate test keys
Generate your test-mode Key ID and Key Secret.
Warning
The Key Secret is shown only once. Store it securely.
Copy test credentials
- Key ID - starts with
rzp_test_ - Key Secret
Configure Razorpay in Emergent
Describe your payment flow
Tell Emergent what you want to build with Razorpay.
Provide your test credentials
When Emergent asks, provide your test-mode Key ID and Key Secret. The agent will securely configure and wire them into the project.
Configure the webhook
When Emergent provides the webhook endpoint and asks for the webhook secret, configure them in Razorpay and provide the secret to the agent.
Implement and test the integration
The agent will implement the checkout and payment verification flow.
Testing in Development
Initiate checkout
Test a payment using Razorpay Test Mode.
Verify payment
Confirm the payment is verified server-side.
Verify webhook
Confirm the webhook is received and processed correctly.
Verify in Dashboard
Check the test payment in the Razorpay Dashboard.
Going Live
Complete KYC and activation
Complete Razorpay's required KYC and account activation.
Generate live keys
Generate your live-mode Key ID and Key Secret.
Update production credentials
After the first publish, update the live Key ID and Key Secret in the Emergent Secret Panel, then re-publish the app.
Configure the production webhook
Configure the production webhook and provide the webhook secret to Emergent when requested.
Publish the app
Publish the app and verify a real payment flow.
Common Use Cases
Subscriptions
Use Razorpay's Subscriptions API to bill customers on a recurring basis (monthly, annually, etc.).
Payment Links
Generate shareable payment links for quick invoicing without building a checkout UI.
Refunds
Issue full or partial refunds programmatically via the Razorpay API.
Smart Collect
Accept payments via UPI, bank transfer, or virtual accounts for B2B scenarios.
Troubleshooting
| Issue | Solution |
|---|---|
| Payment succeeds but webhook isn't received | Confirm your webhook URL is publicly accessible (not in production). Check the Webhooks logs in the Razorpay Dashboard for delivery failures. Verify the endpoint responds with a status. |
| Signature verification fails | Ensure you're using the correct (test vs. live). Check that the concatenation order matches: `order_id |
| Checkout modal doesn't open | Verify the Razorpay Checkout.js script is loaded (). Check browser console for JavaScript errors. Ensure , , and are all correctly populated. |
| Amount mismatch errors | Razorpay amounts are in the smallest currency unit (paise for INR). For ₹100, send (100 × 100). Double-check your multiplication in both order creation and checkout. |
Additional Resources
Need help integrating Razorpay? Describe your payment flow in the Emergent chat, and the AI agents will generate the necessary backend routes, frontend UI, and webhook handlers for you.

