API ReferenceIntegrationsKnowledge Base


Webhooks (Web Callback, HTTP Push API or Reverse API) is one way one web application can send information to another application in real-time when a specific event happens.

If you have subscribed to the order.paid webhook event, you will receive a notification every time a user pays you for an order.

Webhook Vs API🔗

APIs send you the data when you request for it. For Webhooks, you do not need to make a request. You receive the data when it is available.

If you need to know whether a payment link is paid or not, using APIs you need to keep polling every few seconds until someone pays. While if you are using Webhooks, you can configure a webhook event payment_link.paid to receive notifications when a customer makes the payment using the link.

When to Use Razorpay Webhooks🔗

You can use Razorpay Webhooks to configure and receive notifications when a specific event occurs. When one of these events is triggered, we send an HTTP POST payload in JSON to the webhook's configured URL.

  • You can set up Webhooks from your Razorpay Dashboard and configure separate URLs for Live mode and Test mode. Know more about setting up Payments webhooks and RazorpayX webhooks.
  • A Test mode webhook receives events for your test transactions. Know more about testing Webhooks.
  • In webhook URLs, only port numbers 80 and 443 are currently allowed.

Use Cases🔗

There can be multiple uses for webhook events. Two of these are listed below.

Capturing Late Authorized Payments🔗

Capturing payments for which you did not receive a response on the client-side is perhaps the most important use case for the payment.authorized event.

Sometimes, the communication between the bank and Razorpay or between you and Razorpay may not take place. This could be because of a slow network connection or your customer closing the window while the payment is being processed. This could lead to a payment being marked as Failed on the Razorpay Dashboard, but changed to Authorized at a later time. Know more about late authorisation of payments.

You can use webhooks to get notified about payments that get authoriseed and analyse this data to decide whether or not to capture the payment.

Notifications on Failed Payments🔗

When a payment attempted by your customer fails, we receive the failed payment status from the bank. This payment gets recorded in our system as Failed.

If you have enabled the payment.failed webhook, you will receive a notification from us about the failed payment. You can then further analyse this payment and notify your customer about the failure.

Watch Out!
Usually, webhook events are delivered within few seconds of the associated event. However, in some cases, this can be delayed by few minutes due to various reasons.

While we try to send them in a timely manner, we do not recommend relying on Webhooks for events that are time-sensitive. For business-critical, synchronous use cases, please poll our APIs.