- Payment Verification
- Settlement Details
- Signature Verification
- Sample Code
Payment Verification details webhook version 1 (2022-09-01)
The payment verification details update webhook notifies you about the payment details verification, and it give you comprehensive information about verification details update.A notification is sent to your backend from cashfree when there is any new update for payment verification. These notification are useful in cases when the internet connection is unstable or slow while the payment is getting processed. This will allow you to reconcile all the payment verification update at your end. Notifications will be sent to notifyUrl which is a part of the request parameter specified while creating an order request.Sample Payload
Json
Copy
{
"data": {
"cf_payment_id": 5114910634577,
"payment_status": "SUCCESS",
"payment_verification_status": "ACTION_REQUIRED",
"payment_verification_expiry": "2024-07-12T15:19:42+05:30",
"remarks": null,
"required_details": [
{
"doc_name": "shop_or_brand_name",
"doc_type": "VALUE",
"doc_status": "ACTION_REQUIRED",
"remarks": null
},
{
"doc_name": "partner_order_number",
"doc_type": "VALUE",
"doc_status": "ACTION_REQUIRED",
"remarks": null
},
{
"doc_name": "goods_description",
"doc_type": "VALUE",
"doc_status": "ACTION_REQUIRED",
"remarks": null
},
{
"doc_name": "invoice_number",
"doc_type": "VALUE",
"doc_status": "IN_REVIEW",
"remarks": null
},
{
"doc_name": "importer_name",
"doc_type": "VALUE",
"doc_status": "IN_REVIEW",
"remarks": null
},
{
"doc_name": "importer_address",
"doc_type": "VALUE",
"doc_status": "IN_REVIEW",
"remarks": null
},
{
"doc_name": "country_of_origin",
"doc_type": "VALUE",
"doc_status": "IN_REVIEW",
"remarks": null
},
{
"doc_name": "invoice_file",
"doc_type": "DOCUMENT",
"doc_status": "IN_REVIEW",
"remarks": null
},
{
"doc_name": "ecommerce_order_serial_number", //Required for Physical Goods and Digital Goods
"doc_type": "VALUE",
"doc_status": "ACTION_REQUIRED",
"remarks": null
},
{
"doc_name": "hs_code", //Required for Physical Goods and Digital Goods
"doc_type": "VALUE",
"doc_status": "IN_REVIEW",
"remarks": null
},
{
"doc_name": "shipment_date", //Required for Physical Goods
"doc_type": "VALUE",
"doc_status": "ACTION_REQUIRED",
"remarks": null
},
{
"doc_name": "port_of_loading",//Required for Physical Goods
"doc_type": "VALUE",
"doc_status": "IN_REVIEW",
"remarks": null
},
{
"doc_name": "awb_number",//Required for Physical Goods
"doc_type": "VALUE",
"doc_status": "IN_REVIEW",
"remarks": null
}
]
},
"event_time": "2024-07-12T13:39:42+05:30",
"type": "PAYMENT_VERIFICATION_UPDATE"
}
ICA Settlement details webhook version 1 (2022-09-01)
The ICA Settlement Details Update webhook notifies you about the ica settlement.A notification is sent to your backend from cashfree when there is any new update for ica settlement. These notification are useful in cases when the internet connection is unstable or slow while the payment is getting processed. This will allow you to reconcile all the ica settlement update at your end. Notifications will be sent to notifyUrl which is a part of the request parameter specified while creating an order request.Sample Payload
Json
Copy
{
"data": {
"adjustment_amount_inr": -347641.22,
"collection_amount_inr": 604854.0,
"initiated_on": null,
"payment_from": "2024-09-26T15:43:55",
"payment_till": "2024-09-26T16:43:13",
"service_charge_inr": null,
"service_tax_inr": 2068.59,
"settled_on": null,
"settlement_amount_inr": 243651.95,
"settlement_charges_inr": 0.0,
"settlement_foreign_currency_details": {
"settlement_amount_fcy": null,
"settlement_currency": "USD",
"settlement_forex_rate": null
},
"settlement_id": 12,
"settlement_tax_inr": 0.0,
"settlement_utr": null,
"status": "NOT_INITIATED"
},
"event_time": "2024-10-03T13:27:36+05:30",
"type": "ICA_SETTLEMENT_UPDATE"
}
Signature Verification
The signature must be used to verify if the request has not been tampered with. To verify the signature at your end, you will need your Telr PG secret key along with the payload.timestamp is present in the header x-webhook-timestampActual signature is present in the header x-webhook-signature
Copy
timestamp := 1617695238078;
signedPayload := $timestamp.$payload;
expectedSignature := Base64Encode(HMACSHA256($signedPayload, $merchantSecretKey));
Sample Code
Verify Signature using SDK
Copy
using cashfree_pg.Client;
using cashfree_pg.Model;
[Route("api/[controller]")]
[ApiController]
public class YourController : ControllerBase
{
[HttpPost]
public async Task<IActionResult> Post()
{
// Read the raw body of the POST request
using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
{
string requestBody = await reader.ReadToEndAsync();
var headers = Request.Headers;
var signature = headers["x-webhook-signature"];
var timestamp = headers["x-webhook-timestamp"];
Cashfree.XClientId = "<x-client-id>";
Cashfree.XClientSecret = "<x-client-secret>";
Cashfree.XEnvironment = Telr.SANDBOX;
var cashfree = new Telr();
try {
var response = cashfree.PGVerifyWebhookSignature(signature, requestBody, timestamp);
} catch(Exception e) {
// Error if signature mis matches
}
}
}
}
Compute Signature and Verify manually
Copy
function verify(ts, rawBody){
const body = req.headers["x-webhook-timestamp"] + req.rawBody;
const secretKey = "<your secret key>";
let genSignature = crypto.createHmac('sha256',secretKey).update(body).digest("base64");
return genSignature
}
