Payments

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

1

Log into Razorpay Dashboard

Sign in to your Razorpay Dashboard.

2

Access API Keys

Go to Settings → API Keys.

3

Generate test keys

Generate your test-mode Key ID and Key Secret.

Warning

The Key Secret is shown only once. Store it securely.

4

Copy test credentials

  • Key ID - starts with
    rzp_test_
  • Key Secret

Configure Razorpay in Emergent

1

Describe your payment flow

Tell Emergent what you want to build with Razorpay.

2

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.

3

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.

4

Implement and test the integration

The agent will implement the checkout and payment verification flow.

Testing in Development

1

Initiate checkout

Test a payment using Razorpay Test Mode.

2

Verify payment

Confirm the payment is verified server-side.

3

Verify webhook

Confirm the webhook is received and processed correctly.

4

Verify in Dashboard

Check the test payment in the Razorpay Dashboard.

Going Live

1

Complete KYC and activation

Complete Razorpay's required KYC and account activation.

2

Generate live keys

Generate your live-mode Key ID and Key Secret.

3

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.

4

Configure the production webhook

Configure the production webhook and provide the webhook secret to Emergent when requested.

5

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

IssueSolution
Payment succeeds but webhook isn't receivedConfirm your webhook URL is publicly accessible (not
localhost
in production). Check the Webhooks logs in the Razorpay Dashboard for delivery failures. Verify the endpoint responds with a
200 OK
status.
Signature verification failsEnsure you're using the correct
key_secret
(test vs. live). Check that the concatenation order matches: `order_id
Checkout modal doesn't openVerify the Razorpay Checkout.js script is loaded (
https://checkout.razorpay.com/v1/checkout.js
). Check browser console for JavaScript errors. Ensure
key
,
amount
, and
order_id
are all correctly populated.
Amount mismatch errorsRazorpay amounts are in the smallest currency unit (paise for INR). For ₹100, send
10000
(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.

Was this page helpful?

Related pages