Payment GatewaysRazorpay

Razorpay

Connect Razorpay to PayLexer to accept cards, UPI, netbanking, wallets, and other local payment methods in India, with hosted checkout for one-time payments and native subscriptions supporting free trials and sign-up fees.

Razorpay is a Bengaluru, India-headquartered payment gateway built for businesses accepting payments in India, supporting cards, UPI, netbanking, wallets, EMI, and Buy Now Pay Later alongside a growing set of international payment options. One-time payments are collected on Razorpay's own hosted Payment Link page, while subscriptions authenticate through a secure Razorpay overlay that stays on your own checkout page rather than sending the shopper elsewhere.

  • Supported Regions (Merchant Accounts): India (primary market), with payment collection also available in Malaysia, Singapore, and the United States - view full list
  • Supported Currencies: INR, USD, GBP, EUR, AED, SGD, MYR, AUD - view full list

Supported Features

  • Hosted Payment Link page for one-time payments - shoppers are redirected to Razorpay to pay, then returned to your site
  • Cards, UPI, netbanking, wallets, EMI, and Buy Now Pay Later (availability depends on your account's approved methods)
  • Native subscriptions with a configurable billing amount and interval
  • Optional free trial periods that delay a subscription's first real charge
  • Optional one-time sign-up fees, collected up front when the shopper authorizes the subscription
  • Full and partial refunds
  • Signed webhooks for real-time payment, refund, and subscription updates
  • Sandbox (test) mode for end-to-end testing before going live

Before You Start

Make sure you have:

Razorpay's test mode is available immediately after signup for building and testing your integration. Accepting live payments requires completing Razorpay's business verification (KYC) with your company and banking details, which Razorpay must approve first.

Looking for a different payment processor? View all supported gateways →

Configuring Razorpay

You need a Key ID and Key Secret from Razorpay for this integration. Razorpay also issues a separate Webhook Secret, used only to verify that a webhook genuinely came from Razorpay.

Getting API Credentials

Open the Razorpay Dashboard

Log in to the Razorpay Dashboard.

Razorpay Dashboard login screen
Razorpay Dashboard login screen

Select the environment

Use the Test / Live mode toggle in the dashboard to choose the environment:

  • Test mode - generates keys prefixed rzp_test_.
  • Live mode - generates keys prefixed rzp_live_, available once your account is activated.
Test and Live mode toggle in the Razorpay Dashboard
Test and Live mode toggle in the Razorpay Dashboard

Generate and copy the Key ID and Key Secret

Go to Account & Settings → API Keys (under Website and app settings) and click Generate Key. Copy both the Key ID and the Key Secret.

Account and Settings menu in Razorpay with API Keys under Website and app settings
Account and Settings menu in Razorpay with API Keys under Website and app settings
Generate Key button on the Razorpay API Keys page
Generate Key button on the Razorpay API Keys page
Newly generated Key ID and Key Secret displayed once in the Razorpay Dashboard
Newly generated Key ID and Key Secret displayed once in the Razorpay Dashboard

Your Key Secret is shown only once at generation time and is never displayed again. Download and store it securely - if you lose it, you must generate a new key pair.

Adding Credentials to PayLexer

Open PayLexer Dashboard

Log in to your PayLexer dashboard and navigate to Payment Gateways → Razorpay.

PayLexer dashboard Payment Gateways list with Razorpay highlighted
PayLexer dashboard Payment Gateways list with Razorpay highlighted

Enter your credentials

Paste the Key ID and Key Secret you copied from Razorpay into the corresponding fields.

Sandbox Key ID and Key Secret fields for Razorpay in the PayLexer dashboard
Sandbox Key ID and Key Secret fields for Razorpay in the PayLexer dashboard
Live Key ID and Key Secret fields for Razorpay in the PayLexer dashboard
Live Key ID and Key Secret fields for Razorpay in the PayLexer dashboard

Understanding Live/Production and Sandbox Settings:

EnvironmentPurpose
Live / Production (Mandatory)Used for real transactions. Cannot be empty, even when testing.
Test / Sandbox (Optional)Used for testing only. No real money is processed.

How PayLexer selects credentials:

  • Debug/Test mode ON → Test credentials are used
  • Debug/Test mode OFF → Live credentials are used

Configuring Webhooks (Mandatory)

Webhooks enable real-time payment updates and significantly improve reliability.

Benefits of Webhooks:

  • Instant payment status updates
  • Automatic refund processing
  • Subscription renewal and status notifications

Copy your PayLexer webhook URL

In Payment Gateways → Razorpay, copy the Webhook URL that PayLexer generates for your account.

Read-only Webhook URL field on the Razorpay page in the PayLexer dashboard
Read-only Webhook URL field on the Razorpay page in the PayLexer dashboard

Add the webhook in Razorpay

In the Razorpay Dashboard, go to Account & Settings → Webhooks, click + Add New Webhook, and paste the PayLexer Webhook URL.

Add New Webhook button in the Razorpay Dashboard webhook settings
Add New Webhook button in the Razorpay Dashboard webhook settings

Set a secret and select events

Enter a Secret - this becomes the Webhook Secret you paste into PayLexer. Under Active Events, enable at least:

  • payment.captured, payment.failed
  • payment_link.paid, payment_link.expired, payment_link.cancelled
  • refund.created, refund.processed, refund.failed

For subscriptions, also enable subscription.authenticated, subscription.activated, subscription.charged, subscription.completed, subscription.cancelled, subscription.paused, subscription.resumed, subscription.pending, and subscription.halted.

Razorpay webhook setup form showing the secret field and the Active Events checkboxes
Razorpay webhook setup form showing the secret field and the Active Events checkboxes

Create the webhook and save the secret in PayLexer

Click Create Webhook, then paste the same Secret into the Webhook Secret field in Payment Gateways → Razorpay in PayLexer.

Webhook Secret field on the Razorpay page in the PayLexer dashboard
Webhook Secret field on the Razorpay page in the PayLexer dashboard

Razorpay signs every webhook with this Webhook Secret, kept separate from your Key ID and Key Secret - PayLexer verifies the signature before trusting any event. Test mode and Live mode each use their own webhook and secret, so configure both if you use both.

Test and Save

Click Save to save your configuration and verify your credentials. Click Verify Connection to test the connection.

Save and Verify Connection buttons on the Razorpay configuration screen in PayLexer
Save and Verify Connection buttons on the Razorpay configuration screen in PayLexer

Integrate Razorpay to Your Website

If you have already added and configured your site, you can enable Razorpay in your existing setup.

Go to Websites

Navigate to Websites in your PayLexer dashboard.

Edit your website

Click the Edit Icon of your added website.

Websites list in the PayLexer dashboard with the Edit icon on a website row
Websites list in the PayLexer dashboard with the Edit icon on a website row

Enable Razorpay

Click the checkbox to enable Razorpay for the website.

Payment gateway checkboxes for a PayLexer website with Razorpay selected
Payment gateway checkboxes for a PayLexer website with Razorpay selected

If you haven't added a website yet, Continue to Add Your Website →

Troubleshooting

Best Practices

  • Test in sandbox before enabling production - complete a full checkout, subscription, and refund with Test keys first.
  • Enable webhooks for both Test and Live mode, each with its own Webhook Secret.
  • Keep your Key Secret and Webhook Secret private - treat them like passwords.
  • Complete Razorpay's business verification (KYC) early, since live activation depends on its approval.

FAQs

Still Have Questions?

Was this page helpful?