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, reaching 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 charged alongside a subscription's first billing cycle
  • Subscription authorization happens in a secure overlay on your own checkout page, not a separate hosted page
  • 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.

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.

Generate and copy the Key ID and Key Secret

Under Products menu go to Account & Settings → API Keys (under Website and app settings) and click Generate Key. Copy both Key ID and Key secret.

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.

Enter your credentials

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

Understanding Live/Production and Sandbox Settings:

EnvironmentPurpose
Live / ProductionUsed for real transactions.
Test / SandboxUsed 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

Test and save

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

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.

Add the webhook in Razorpay

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

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.charged, subscription.completed, subscription.cancelled, subscription.paused, subscription.resumed, subscription.pending, and subscription.halted.

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.

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.

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.

Enable Razorpay

Click the checkbox to enable Razorpay for the website.

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?