Razorpay Integration
Connect your Razorpay account to Paygent to collect invoice payments through Razorpay Payment Links. Paygent generates hosted payment links, can embed them in invoice emails, and marks invoices as paid when Razorpay confirms the payment via webhook.
What Paygent handles for you:
- Creates Razorpay Payment Links for unpaid invoices
- Maps Paygent customers to Razorpay Customers on first payment link
- Verifies webhook signatures (HMAC-SHA256) and records payments automatically
- Stores API credentials encrypted — only masked values are shown in the dashboard
Prerequisites
- A Razorpay account with API access (test or live mode)
- At least one customer with an email address (required for automated invoice emails)
- An unpaid invoice with a total amount greater than zero
Setup overview
Step 1 — Connect Razorpay in Paygent
- Open Settings → Integrations in the Paygent dashboard.
- Toggle Razorpay on (or click Edit if already connected).
- Enter a connection name (for example,
Production Razorpay). - Paste your Key ID — starts with
rzp_test_orrzp_live_. - Paste your Key Secret (shown once when you generate the key pair).
- Paste your Webhook Secret (you set this in Step 2 when creating the webhook — you can save the connection after the webhook is ready, or edit later).
- Click Save Connection. Copy the webhook URL shown on the card — you need it in the next step.
Where to find your Razorpay API keys: In the Razorpay Dashboard → Account & Settings → API Keys, generate a Test or Live key. Copy both the Key ID and Key Secret. Use test keys while setting up; switch to live keys for production.
Step 2 — Configure the Razorpay webhook
Paygent needs Razorpay to send events when a customer completes payment. The webhook URL is unique to your organization and shown in the Razorpay connection card / modal under Settings → Integrations.
In the Razorpay Dashboard
- Make sure you are in the correct mode (Test or Live) — webhooks are mode-specific.
- Go to Account & Settings → Webhooks and click Add New Webhook (or + Create New Webhook).
- Paste your Paygent webhook URL (copy it from Settings → Integrations → Razorpay).
- Set a Secret (any strong string you choose). You will paste the same value into Paygent as the Webhook Secret.
- Under Active Events, enable exactly these two events (see table below).
- Save the webhook.
- Return to Paygent → Settings → Integrations → Edit Razorpay and paste the webhook secret if you did not save it during initial connect.
Test mode webhook OTP: When creating, editing, or deleting a webhook in Test mode, Razorpay may ask for an OTP. Use the default test OTP: 754081.
Webhook events to enable
Paygent listens only to these events. Enable both so payment confirmation works whether the capture arrives as a payment event or as a payment-link event.
Do not enable other events for Paygent: Events such as payment.authorized, payment.failed, order.paid, or refund.* are not handled by Paygent today. Enabling them is harmless (they are acknowledged and ignored) but not required.
Test vs live mode: API keys and webhooks are separate for Razorpay Test and Live modes. When you go live, create a new webhook in Live mode, use Live Key ID / Key Secret, and update all three values in Paygent.
Step 3 — Collect payments on invoices
Once Razorpay is connected, you can collect payment in two ways.
Option A — Generate a payment link manually
- Open an unpaid invoice from the Invoices list.
- Open the actions menu (⋯) and click Generate Razorpay Link.
- Copy the short URL (or open it) and send it to your customer.
- After payment, the customer is redirected to a Paygent confirmation page; the invoice status updates automatically via webhook.
Option B — Include a Razorpay link in invoice emails
- Configure email delivery under Settings → Email.
- When creating or editing an order, set Invoice email to Send invoice with Razorpay payment link.
- When an invoice is generated and emailed, Paygent creates a Payment Link and embeds the short URL in the email body.
Email requirements: Automated emails need an active email provider under Settings → Email, and the customer (or order contact) must have a valid email address.
Step 4 — How payment confirmation works
- Customer pays on the Razorpay hosted payment page.
- Razorpay sends
payment.capturedand/orpayment_link.paidto your Paygent webhook URL with headerX-Razorpay-Signature. - Paygent verifies the HMAC-SHA256 signature using your stored webhook secret.
- The payment link record is marked completed, and the invoice is recorded as paid (
paymentMethod: razorpay).
Manual fallback: If a webhook is delayed or misconfigured, you can still mark the invoice paid from the invoice page using Record Payment with method Razorpay (manual).
Key differences from Stripe
- Razorpay needs Key ID + Key Secret (Stripe uses a single secret key).
- You choose the webhook secret yourself in the Razorpay Dashboard (Stripe generates a
whsec_...signing secret). - Required events:
payment.captured+payment_link.paid(Stripe:checkout.session.completed). - Signature header is
X-Razorpay-Signature(HMAC-SHA256 over the raw body).
