Skip to main content
Webhooks are HTTP callbacks that Cashfree Payments sends to your server when specific events occur in your payout transactions. They provide real-time notifications about transfer status changes, enabling you to automate your business processes and keep your systems synchronised with transaction updates. Version 2 webhooks offer enhanced reliability, improved payload structure, and additional event types compared to the previous version. They’re essential for maintaining accurate transaction records and providing timely updates to your end users about their transfer status. For seamless integration and security in handling your transactions, refer to the following essential guidelines:

Add a webhook

Follow the instructions below to configure webhooks for version 2 APIs:
  1. Log in to the Merchant Dashboard.
  2. Select Payouts.
  3. Navigate to Developers > Webhooks.
  4. Click Add Webhook URL on the Webhooks page.
  1. In the Add Webhook popup, enter the following information:
    • Webhook URL: Enter the URL where you want to receive transfer-related notifications.
    • Select a webhook version: Select V2 from the dropdown menu.
Webhook Version: V2: You will receive V2 webhooks only if you select the option as described and configure the respective URL.
  1. Click Test & Add Webhook.

Webhook signature verification code

These code snippets provide functionality to verify the authenticity of webhook requests and parse the payload data. They ensure that incoming webhook requests are from a trusted source by checking their signature and then processing the request data.
type PayoutWebhookEvent struct {
Type   string
Raw    string
Object interface{}
}

func PayoutVerifyWebhookSignature(signature string, rawBody string, timestamp string) (*PayoutWebhookEvent, error) {
signatureString := timestamp + rawBody
hmacInstance := hmac.New(sha256.New, []byte(*XClientSecret))
hmacInstance.Write([]byte(signatureString))
bytesData := hmacInstance.Sum(nil)
generatedSignature := base64.StdEncoding.EncodeToString(bytesData)
if generatedSignature == signature {
var object interface{}
err := json.Unmarshal([]byte(rawBody), &object)
if err != nil {
return nil, errors.New("something went wrong when unmarshalling raw body")
}
if objectAsMapInterface, ok := object.(map[string]interface{}); ok {
if webhookType, ok := objectAsMapInterface["type"].(string); ok {
return &PayoutWebhookEvent{Type: webhookType, Raw: rawBody, Object: object}, nil
}
}
return &PayoutWebhookEvent{Type: "", Raw: rawBody, Object: object}, nil
}
return nil, errors.New("generated signature and received signature did not match")
}
Client secret for webhooksignature
Please ensure that the oldest active client secret is used to generate the webhook signature. Using any other client secret will lead to a signature mismatch.

Components

The webhook signature verification implementation uses the following key components to ensure secure processing of webhook events:

PayoutWebhookEvent class

This class represents the structure of a webhook event and contains the following properties:
PropertyTypeDescription
TypestringThe type of the event.
RawstringThe raw JSON body of the webhook request.
ObjectobjectThe parsed JSON object from the raw body.

PayoutVerifyWebhookSignature method

This method verifies the signature of a webhook request and parses the data. Use the following parameters when calling this method:
ParameterTypeDescription
signaturestringThe HMAC signature provided in the header information of the webhook.
rawBodystringThe raw JSON body of the request in string format.
timestampstringThe timestamp provided in the header information of the webhook.

Cashfree class

This class provides the method for verifying webhook signatures and includes the following properties:
PropertyTypeDescription
XClientSecretstringSecret key.
XAPIVersionstringThe API version: 2024-01-01.

Webhook events

Payouts webhooks enable you to receive updates about all event-driven activities originating from your account. Below is the list of payout webhooks:
EventsNotifications
TRANSFER_ACKNOWLEDGEDYou receive this event when the transfer is successful, the amount is debited from the account, and the funds are credited to the end user.
TRANSFER_SUCCESSYou receive this event when the transferred amount is deposited in the beneficiary’s bank account.
TRANSFER_FAILEDYou receive this event when the transfer attempt fails.
TRANSFER_REVERSEDYou receive this event when the beneficiary’s bank reverses the transfer request.
TRANSFER_REJECTEDYou receive this event when Cashfree Payments rejects the transfer request.
BULK_TRANSFER_REJECTEDYou receive this event when one or more transfers in the batch transfer request are rejected.
BENEFICIARY_INCIDENTYou receive this event when there is a service disruption or incident affecting a specific beneficiary bank or payment mode.
CREDIT_CONFIRMATIONYou receive this event when funds are credited to your account balance, providing confirmation of the credit transaction.
LOW_BALANCE_ALERTYou receive this event when your account balance falls below a predefined threshold, alerting you to add funds.

Sample payload

The following examples show the JSON payload structure for each webhook event type listed above. Each payload contains event-specific data that helps you understand the transfer status and take appropriate action in your application.
{
	"data": {
		"transfer_id": "JUNOB2018",
		"cf_transfer_id": "123456",
		"status": "SUCCESS",
		"status_code": "COMPLETED",
		"status_description": "The transfer has been initiated via the partner bank successfully, hence your account is debited and the request is successfully processed by the beneficiary bank and has been credited to the end beneficiary.",
		"beneficiary_details": {
			"beneficiary_id": "JOHN18011",
			"beneficiary_instrument_details": {
				"bank_account_number": "7766671501729",
				"bank_ifsc": "SBIN0000003"
			}
		},
		"transfer_amount": 1,
		"transfer_service_charge": 1,
		"transfer_service_tax": 0.18,
		"transfer_mode": "BANK",
		"transfer_utr": "TESTR92023012200543116",
		"fundsource_id": "CASHFREE_1",
		"added_on": "2021-11-24T13:39:25Z",
		"updated_on": "2021-11-24T13:40:27Z"
	},
	"event_time": "2024-07-25T17:43:37",
	"type": "TRANSFER_ACKNOWLEDGED"
}

Parameters

Find the parameters and their descriptions for the events TRANSFER_ACKNOWLEDGED, TRANSFER_SUCCESS, TRANSFER_FAILED, TRANSFER_REVERSED, and TRANSFER_REJECTED below:
ParameterDescription
transfer_idThe unique ID you created to identify the transfer request.
cf_transfer_idThe unique ID created by Cashfree Payments for reference purposes.
statusThe status of the transfer.
status_codeThe specific status of the transfer.
status_descriptionThe detailed explanation of the transfer status.
beneficiary_detailsInformation about the beneficiary.
beneficiary_idThe unique ID to identify the beneficiary.
beneficiary_instrument_detailsThe account information of the beneficiary.
bank_account_numberThe bank account number of the beneficiary.
bank_ifscThe IFSC information of the bank.
transfer_amountThe transfer amount.
transfer_service_chargeThe service charge applied for the transfer amount.
transfer_service_taxThe taxable amount for the service charge.
transfer_modeThe transfer mode.
transfer_utrThe unique transaction reference number.
fundsource_idThe unique ID to identify the fund source.
added_onThe date and time of the addition.
updated_onThe date and time of the update.
event_timeThe date and time of the webhook event initiation.
typeThe event type.
Find the parameters and their descriptions for the event BULK_TRANSFER_REJECTED below:
ParameterDescription
batch_transfer_idThe unique ID you created to identify the batch transfer request.
cf_batch_transfer_idThe unique ID created by Cashfree Payments for reference purposes.
statusThe status of the batch transfer request.
event_timeThe date and time of the webhook event initiation.
typeThe event type.
A transfer is considered successful only when both the status is SUCCESS and the status code is COMPLETED.

Webhook retries

Cashfree Payments webhooks service does its best to deliver events to your webhook endpoint. It’s best practice for your application to respond to the callback. Our webhook service may send many payloads to a single endpoint in quick succession. You will need to build an application and configure your server to receive the response we send when events get triggered during the payout process. Your server should return a 200 HTTP status code to acknowledge that you received the webhook without any issues. Any other information you return in the request headers or request body is ignored. Any response code outside the 200 range, including 3xx codes, indicates that you didn’t receive the webhook. When Cashfree Payments doesn’t receive the acknowledgement for any reason, we retry to establish communication at regular intervals. If we don’t receive the response after several attempts, we gradually decrease the rate of retries. Based on this count, the service is disabled if it fails more than five times. If you don’t receive notifications from Cashfree Payments as expected, please fill out the Support Form.

IPs to whitelist

When you decide to consume the webhooks, first, you need to verify whether your systems need IP whitelisting to be done at your end or not. Accordingly, you can whitelist the below IPs of Cashfree:
UAT
52.66.25.127
15.206.45.168
Prod
52.66.101.190
3.109.102.144
3.111.60.173
18.60.134.245
18.60.183.142
Port
443 (secured)

FAQs

Yes, you can subscribe to Webhooks V2 even if you’re currently using Payout APIs v1 and v1.2.
Yes, you can typically subscribe to Webhooks V1 even if you’re using Payout APIs V2.
I