How do I test Razorpay webhooks locally?
Use ngrok to expose your local server: ngrok http 3000. You get a public HTTPS URL. Set this URL as the webhook URL in the Razorpay dashboard. Now Razorpay can send webhooks to your local server for testing.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Testing and Debugging Razorpay Payments in Node.js Test Mode and Error Handling
Use test mode with rzp_test_ keys. Use test card 4111 1111 1111 1111 (Visa) with any future expiry and any CVV for success. For UPI, use success@razorpay. No real money is charged. Test all payment methods, failures, and webhooks before going live.
Common causes: using express.json() instead of express.raw() for the webhook route (the signature is on the raw body), different webhook secret in .env vs the dashboard, or body parsing modifying the content. Use express.raw({ type: 'application/json' }) for the webhook route.
Invalid API key (check test vs live keys), amount mismatch (ensure frontend sends exact order amount in paise), order already paid (create a new order for retry), webhook not received (check HTTPS URL, use ngrok for local), signature verification failed (use express.raw, check webhook secret).
Still have questions?
Browse all our FAQs or reach out to our support team
