# What are webhooks?

Webhooks are server callbacks to your server from Cashfree Payments. Webhooks are event-based and are sent when specific events related to a transaction happen.

# How to use Cashfree Payments webhooks?

## 1. Create an endpoint URL

To receive event notifications, you need to create an endpoint in your server that can accept requests from Cashfree Payments. The endpoint URL can be HTTP in your local machine for testing purposes while developing. However, it should be HTTPS for the production environment. You receive webhook event notifications on the specified URLs. You can use one URL to handle different event types at once or specify individual URLs for specific events.

## 2. Select events to subscribe

Cashfree Payments sends the following webhooks for Payment Gateway:

  • [Payment Webhooks](🔗)

  • [User Dropped](🔗)

  • [Payment Failed](🔗)

  • [Incident Service](🔗)

  • [Refunds](🔗)

  • [Settlement Webhooks](🔗)

You may configure webhooks to get notified of events you want.


For each event, you'll get different requests. Please check sample payload for each event to handle them accordingly.

## 3. Test webhooks

Test your webhooks in the sandbox environment before going live to check payloads and integration. Configuring your webhooks, from the dashboard, in the test environment and events triggered in test transactions will send webhooks to the configured endpoint.

You can create endpoint URLs and test webhooks using tools like [webhook.site](🔗) or create a tunnel to your localhost using tools like [ngrok](🔗).

## 4. Verify webhooks

It is a best practice to verify webhooks so that your server is not manipulated by other requests acting as Cashfree webhooks. Use [webhook signatures](🔗) to verify Cashfree Payments webhooks and perform further actions only after verifying the webhook.

## 5. Handle Requests from Cashfree Payments

Cashfree Payments sends a webhook to the defined endpoint URL as a POST request with a JSON payload. It sends different requests for different events. You may check the sample payload for each event and read the payload accordingly.


Your endpoint should return a 2xx response for a successful webhook delivery from our end. Please ensure the response is quick before performing other logic, which could cause a timeout.