Test Webhooks🔗
You can test the webhooks to verify payloads or check if your webhook integration is working. Test events get triggered on a transaction done in the Test mode. As the payload structure remains the same in the Live and Test modes, you can rely on your stage testing.
You can test webhooks:
- Using request interceptor tools
- On an application running on localhost
- On an application running on your staging environment
Using Request Interceptor Tools🔗
There are many free webhook testing tools available online. A simple Google search for test webhooks online returns multiple sites that you can use to test webhooks. For example, requestbin.com.
To test webhooks:
- Open requestbin.com.
- Click Create Request Bin and log in using Google or GitHub to create a private bin. Alternatively, you can opt for a public bin.
- Copy the endpoint created for you.
- Proceed to set up webhooks, but with the following changes:
- Ensure you are using Test mode on the Razorpay Dashboard.
- Paste the endpoint you copied in the previous step in the Website URL field.
If you have enabled the appropriate webhook event during setup, you will receive the corresponding webhook payload on your requestbin.com site.
Application Running on Localhost🔗
You cannot use localhost directly to receive webhook events as webhook delivery requires a public URL. You can handle this by creating a tunnel to your localhost using tools such as ngrok or localtunnel.
You can refer to the ngrok documentation to get started. Use the URL endpoint generated by these tools in the webhook URL while setting up your webhooks.
Application Running on Your Staging Environment🔗
You can test your webhook integration in the staging environment before taking it live. You should set up webhooks in the Test mode. You can configure your staging host endpoint in test mode and receive test events on it.