Signature verification
Payment Gateway, Payouts V2, Secure ID, and PPI all use the same HMAC-SHA256 header-based algorithm. Payouts V1 (Cashgram) uses form-encoded POST parameters.Header-based verification
Applies to Payment Gateway, Payouts V2, Secure ID, and PPI. The signature is in thex-webhook-signature header. The timestamp used in the signature is in x-webhook-timestamp.
Algorithm:
Cashfree signs webhooks using the client secret that was active at the time the event was sent. If you have rotated your client secret, keep the previous secret active until all in-flight webhooks from that period have been processed.
Payouts V1: Cashgram
Cashgram webhooks use form-encoded POST parameters rather than a JSON body. The signature is computed as follows:- Collect all POST parameters except
signatureinto an array. - Sort the array by key in ascending alphabetical order.
- Concatenate all non-empty values in the sorted order to form
postData. - Compute
HMAC-SHA256(postData, clientSecret)and Base64-encode the result. - Compare the result to the received
signatureparameter. Reject the request if the values don’t match.
PHP
Sample payloads
The event discriminator field istype for Payment Gateway and Payouts V2, and event_type for Secure ID and PPI. Cashgram payloads are form-encoded, not JSON. Always validate field names and enum values against the product page for your API version.
The Cashgram payload shows the POST parameter names formatted as JSON for readability. In practice, Cashgram webhooks arrive as
application/x-www-form-urlencoded POST parameters, not as a JSON body. See Cashgram webhooks for the authoritative parameter list.