Razorpay Webhooks
How to Test Razorpay Webhooks Locally (2026)
Razorpay sends webhooks for payment, order, subscription, refund, and dispute events. Razorpay signs each webhook with HMAC-SHA256 over the raw request body using your webhook secret, delivered in the X-Razorpay-Signature header.
With HookSense, point Razorpay at a callback endpoint and let an AI agent await the result over MCP: create_callback_endpoint → wait_for_callback → verify_signature. Run npx @hooksense/mcp in Claude Desktop, Cursor, or any MCP client. No polling.
Signature Header
X-Razorpay-Signature
Algorithm
HMAC-SHA256
Setup Guide
- 1Create a free HookSense endpoint at hooksense.com
- 2Copy your unique webhook URL
- 3In the Razorpay Dashboard → Settings → Webhooks → Add New Webhook
- 4Paste your HookSense URL and set a webhook secret
- 5Add the same secret to HookSense for automatic HMAC verification
- 6Select the events you want to receive and save
- 7Trigger a test event to see it land in HookSense
Common Razorpay Webhook Events
payment.authorizedpayment.capturedpayment.failedorder.paidsubscription.activatedsubscription.chargedrefund.createdpayment.dispute.createdForward to Localhost
Use HookSense CLI to forward Razorpay webhooks directly to your local development server:
npx hooksense listen -p 3000 --path /api/integrations/razorpayNo ngrok or tunnel setup required. Install with npm i -g hooksense or use npx.
Tips & Best Practices
- The signature is HMAC-SHA256 over the raw body — verify before parsing JSON
- Use the x-razorpay-event-id header to dedupe — Razorpay may deliver the same event more than once
- Test and live mode use separate webhook secrets — keep them distinct in HookSense
- Replay captured payment.captured events to retest your handler idempotency
Related
Give your agent a Razorpay callback
Create a free callback endpoint and have an agent await its first verified Razorpay webhook over MCP. Paid plans are early-access.
Get Started Free