Test Razorpay webhooks
Razorpay sends webhooks for payments, orders, settlements, refunds, and subscription events. Capture them on a free webhooks.cc endpoint to see exactly what Razorpay sends, or fire realistic, correctly signed sample payloads at your own handler without touching a production account.
No credit card · 50 requests/day free · or get a guest URL without an account
Prefer a walkthrough? Read the local webhook testing guide.
Common Razorpay webhook events
Razorpay sends an HTTP POST with a JSON payload for each event you subscribe to, with separate webhook URLs for Live and Test mode. Every delivery carries an x-razorpay-event-id header that is unique per event.
| Event | When it fires |
|---|---|
| payment.authorized | A payment is authorised |
| payment.captured | A payment is successfully captured |
| payment.failed | A payment fails |
| order.paid | An order is successfully paid |
| refund.processed | A refund is successfully processed |
| refund.failed | Razorpay could not process a refund |
Source: Razorpay webhooks documentation.
How to test Razorpay webhooks
- 1
Create a webhook endpoint
Sign in free with GitHub, Google, or email to create a persistent endpoint, or grab an instant guest URL at webhooks.cc without an account.
- 2
Point Razorpay at your URL
Paste the endpoint URL into Razorpay: Razorpay Dashboard → Account & Settings → Webhooks.
- 3
Inspect what arrives
Each delivery appears live in the dashboard with method, headers, body, query parameters, and source IP.
- 4
Forward to localhost or assert in CI
Run whk tunnel <port> to forward webhooks to a local server, or use the TypeScript, Python or Go SDK to wait for and assert on deliveries in tests.
Razorpay webhook signature
| Signature header | x-razorpay-signature |
|---|---|
| Algorithm | HMAC-SHA256 |
| Verification in webhooks.cc | Supported: add your signing secret and every request is checked automatically |
Checking one request by hand? Paste its body and headers into the webhook signature checker, which has the Razorpay scheme built in and runs in your browser.
New to signature verification? Read the webhook signature verification guide.
Send sample Razorpay events
These Razorpay templates ship with realistic payloads and valid signature headers. Send them from the dashboard's Send button, the SDK, or your AI agent via MCP.
payment.capturedpayment.failedorder.paid# Send a signed Razorpay sample with the SDK
await client.endpoints.sendTemplate( slug, {
provider: "razorpay",
template: "payment.captured",
secret: "your-test-secret",
});Test your Razorpay webhook handler in CI
sendTo signs each request the way Razorpay does, with your test secret from RAZORPAY_WEBHOOK_SECRET, and posts it straight to your handler, so its signature check stays on. The second test proves the handler rejects a forged signature. Drop the file into a Vitest suite that runs against your app; for Jest, delete the first line, since Jest provides the same globals.
import { describe, expect, it } from "vitest";
import { WebhooksCC } from "@webhooks-cc/sdk";
// Runs against your app on localhost. WHK_API_KEY and RAZORPAY_WEBHOOK_SECRET come from the env.
const client = new WebhooksCC({ apiKey: process.env.WHK_API_KEY! });
const url = "http://localhost:3000/api/webhooks/razorpay";
const send = (secret: string) =>
client.sendTo(url, {
provider: "razorpay",
template: "payment.captured",
secret,
});
describe("Razorpay webhook handler", () => {
it("accepts a signed payment.captured", async () => {
const response = await send(process.env.RAZORPAY_WEBHOOK_SECRET!);
expect(response.status).toBeGreaterThanOrEqual(200);
expect(response.status).toBeLessThan(300);
});
it("rejects a forged signature", async () => {
const response = await send("not-the-real-secret");
// A 4xx, not a crash: providers retry 5xx responses.
expect(response.status).toBeGreaterThanOrEqual(400);
expect(response.status).toBeLessThan(500);
});
});
Let your coding agent write and run it: the webhooks.cc agent skill teaches Claude Code, Cursor, and Codex to test webhook handlers with signed payloads. More patterns in the SDK testing docs.
Everything in one place
- Live dashboard: see deliveries the moment they arrive
- Forward to localhost with whk tunnel
- Replay any captured request to any URL
- Mock responses with custom status, headers, and body
- Forward to your servers, Slack or Discord
- TypeScript, Python and Go SDKs for CI assertions
- MCP server for AI coding agents
Razorpay webhook questions
Razorpay computes a hex HMAC-SHA256 of the raw request body, keyed with the secret you set on the webhook, and sends it in X-Razorpay-Signature. Recompute it over the unparsed body and compare in constant time: Razorpay's docs warn against parsing or casting the body first. After you change the secret, retries of older events are still signed with the old one.
A non-2xx response, or no response within 5 seconds, is a failed delivery. Razorpay retries with exponential backoff for 24 hours after the event was created, and disables the webhook if deliveries keep failing for those 24 hours; you re-enable it in the Dashboard once it is fixed. Delivery is at least once, so deduplicate on x-razorpay-event-id.
Create a free endpoint on webhooks.cc (sign in with GitHub, Google, or email, or use a guest endpoint without an account), then configure it as your webhook URL: Razorpay Dashboard → Account & Settings → Webhooks. Every delivery shows up live in the dashboard with full headers, body, and query parameters. To hit a local server, run whk tunnel <port> and the CLI forwards each webhook to localhost.
Yes. webhooks.cc ships Razorpay templates (payment.captured, payment.failed, order.paid) with realistic payloads and correctly computed signature headers. Send them from the dashboard, the SDK, or the MCP server to exercise your handler end-to-end.
Razorpay signs each delivery with the x-razorpay-signature header using HMAC-SHA256. webhooks.cc verifies these signatures for you: add your signing secret to the endpoint and every captured request is marked valid or invalid in the dashboard.
Yes. A free account gets you persistent endpoints, 50 requests per day, 7-day retention, and full CLI, SDK, and MCP access, with no credit card. You can also try a guest endpoint without an account: up to 25 requests for 12 hours.
More providers
Your Razorpay webhook URL is seconds away
Sign up free, create an endpoint, and point Razorpay at it.
No credit card · or try without an account