Skip to main content
This page covers the signature verification algorithm you must implement before processing any webhook, and sample payloads for common event types. If you haven’t registered a webhook URL yet, start with Configure webhook endpoints.

Signature verification

Verify the signature on every incoming webhook request before you trust or act on its payload. Skipping verification allows forged requests to trigger business logic and fraudulent event injection.
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 the x-webhook-signature header. The timestamp used in the signature is in x-webhook-timestamp. Algorithm:
Always compute the signature from the raw request body string. Parsing and re-serialising JSON can change whitespace, field order, or number formatting and will cause verification to fail.
Use the official Cashfree SDK where available. It captures the raw body and performs signature verification in a single method call, reducing the risk of implementation errors.
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.
For additional language samples, see Secure ID webhook signature verification and PPI webhook signature verification.

Payouts V1: Cashgram

Cashgram webhooks use form-encoded POST parameters rather than a JSON body. The signature is computed as follows:
  1. Collect all POST parameters except signature into an array.
  2. Sort the array by key in ascending alphabetical order.
  3. Concatenate all non-empty values in the sorted order to form postData.
  4. Compute HMAC-SHA256(postData, clientSecret) and Base64-encode the result.
  5. Compare the result to the received signature parameter. Reject the request if the values don’t match.
PHP
For the full parameter list and ordering rules, see Cashgram webhooks.

Sample payloads

The event discriminator field is type 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.