About Webhooks

Use webhooks to get notified about events related to the payment flow such as orders, payments, settlements, disputes and workflow steps related to other Razorpay Products.


Webhooks (Web Callback, HTTP Push API or Reverse API) automatically notify your application when specific events occur. Instead of continuously polling APIs to check for updates, webhooks push notifications directly to your server when events happen.

Here is how webhooks compare to traditional API polling:

When you subscribe to webhook events, Razorpay sends an HTTP POST request with JSON payload to your configured endpoint URL whenever those events are triggered.

Suppose you have subscribed to the order.paid webhook event, you will receive a notification every time a user pays you for an order, in the configured endpoint URL.

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

Capturing Late Authorised 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 occur. This could be because of a slow network connection or your customer closing the window while processing the payment. This could lead to a payment being marked as Failed on the Dashboard but changed to Authorized at a later time. Know more about

.

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

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.

Suppose 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.

  • You can set up webhooks from your Dashboard and configure separate URLs for Live mode and Test mode. Know more about setting up .
  • A Test mode webhook receives events for your test transactions. Know more about .
  • Webhook URLs must use ports 80 or 443 only.

Implementation Considerations

Webhooks are the primary and most efficient method for event notifications. They are delivered asynchronously in near real-time. For critical user-facing flows that need instant confirmation (like showing "Payment Successful" immediately), supplement webhooks with API verification.

Recommended approach

  • Rely on webhooks for all automation, which can be asynchronous.
  • If a critical user-facing flow requires instant status, but the webhook notification has not arrived within the time mandated by your business needs, perform an immediate API Fetch call (, and ) to verify the status.


Was this page helpful?


webhooks
webhooks uses
using webhooks
payment notifications
notification