Docs menu
Docs/Cashfree

Cashfree integration setup

Use signed Cashfree webhooks to send successful payments, failures and refunds into Metrivo. Payment attribution stays confidence-labeled and does not invent matches.

Cashfree revenue is signed-webhook evidence only. Metrivo does not request a charge-capable Cashfree key, and a payment is never marked connected until a signed event is accepted.

Signed inbound webhooks

Cashfree signs every webhook with your PG secret key, so that key is the secret Metrivo needs. It is encrypted before storage and never rendered back after save. Metrivo verifies the Base64 HMAC-SHA256 of the timestamp and raw body before recording anything.

Setup steps

  1. 1. Open Metrivo Data Connections and generate the Cashfree webhook URL.
  2. 2. In the Cashfree dashboard, open Developers → Webhooks and add the Metrivo URL as a payment webhook endpoint.
  3. 3. Select payment success, payment failed and refund status events.
  4. 4. Save your Cashfree PG secret key in Metrivo.
  5. 5. Use Test webhook or complete a sandbox payment. Metrivo marks the provider active only after a signed successful payment is accepted.

Cashfree signs the exact raw body. Re-serialising it changes decimals such as 170.00, which is why Metrivo verifies the body as received.

Metadata for attribution

Pass Metrivo visitor and session identifiers in order_tags when you create the order. Cashfree returns them on the payment webhook under data.order.order_tags. Tag values must be strings.

// Client: send this object to your checkout endpoint
const metadata = window.Metrivo.getAttributionMetadata()

// Server
await fetch("https://api.cashfree.com/pg/orders", {
  method: "POST",
  headers: { "x-api-version": "2023-08-01", "x-client-id": id, "x-client-secret": secret, "Content-Type": "application/json" },
  body: JSON.stringify({
    order_amount: 499,
    order_currency: "INR",
    customer_details: { customer_id, customer_email, customer_phone },
    order_tags: metadata,
  }),
})

How Metrivo reads Cashfree events

  • PAYMENT_SUCCESS_WEBHOOK is the only event that records revenue, using payment_amount in major units and the payment's currency.
  • REFUND_STATUS_WEBHOOK updates the existing payment instead of creating a new row, and only when the refund status is SUCCESS. A refund smaller than the order is recorded as partially refunded.
  • PAYMENT_FAILED_WEBHOOK is recorded as a failed payment so it appears in recovery reporting.
  • Other events such as user-dropped payments are stored as evidence and carry no money.

Contract read from the Cashfree documentation, checked 2026-10-28.