Skip to main content

Webhooks

What are Webhooks?

Webhooks are a method of communication between two applications in real-time. They enable merchants to receive notifications or trigger actions automatically when certain events occur in the payment system.

Why Webhooks?

  1. Real-time Updates: Webhooks provide merchants with instant notifications about important events, such as successful payments, refunds, or chargebacks, allowing them to respond promptly.

  2. Automated Processes: By integrating with webhooks, merchants can automate various tasks, such as updating order statuses, sending confirmation emails, or updating inventory levels, without manual intervention.

  3. Enhanced User Experience: With webhooks, merchants can provide a seamless and efficient checkout experience for customers by triggering actions instantly, ensuring timely communication and order processing.

How do Webhooks Work?

When you integrate webhooks into your system, you'll receive HTTP POST requests containing JSON data whenever specific events occur in the payment system. These requests, known as webhook responses, provide real-time notifications about important events such as successful payments and refunds. Please connect with the onboarding and configuration team for webhook registration & event triggering.

Webhook Events

IDName
1payment.captured
2payment.completion
3payment.failed
4payment.refund.success

Sample Webhook Response

{
"event_name": "payment.captured",
"merchant_response": {
"merchant_id": "29792",
"payment_mode": "EMI",
"merchant_access_code": "d860a376-2182-4448-9d87-2b2c752b8991",
"unique_merchant_txn_id": "c-947711168513-03070150-1",
"pine_pg_txn_status": "4",
"txn_completion_date_time": "03/03/2024 12:33:02 PM",
"product_code": "273865",
"captured_amount_in_paisa": "13559000",
"refund_amount_in_paisa": "0",
"txn_response_code": "1",
"amount_in_paisa": "14059000",
"txn_response_msg": "SUCCESS",
"acquirer_name": "HDFC_FSS_IN_HOUSE",
"pine_pg_transaction_id": "294774500",
"rrn": "406358019945",
"auth_code": "055712",
"masked_card_number": "************2562",
"card_holder_name": "name",
"mobile_no": "9810505359",
"salted_card_hash": "651BB095DE12C950EF09401518017A06C5DC1A1FE5D0E7782A373F7CFB5482A3",
"udf_field_1": "110014C25 1st FloorJangpura extension jangpura new delhiDELHIDELHI",
"udf_field_2": "492001Hudco Regional Office 1B Surya ApartmentsKatora Talab Civil Lines RaipurRAIPURCHHATTISGARH",
"udf_field_3": "273865",
"udf_field_4": "01eae2ec05761000bbea86e16dcb4b79CROMA41646",
"emi_tenure_month": "1",
"emi_interest_rate_percent": "0.00",
"emi_principal_amount_in_paisa": "13559000",
"emi_amount_payable_each_month_in_paisa": "0",
"is_brand_emi_txn": "1",
"emi_cashback_type": "0",
"parent_txn_status": "",
"parent_txn_response_code": "",
"parent_txn_response_message": "",
"issuer_name": "HDFC",
"product_category": "MacBook Air",
"manufacturer": "Apple Macbook",
"product_discount": "500000"
}
}

Response Parameters

Description of Response Parameters
Parameter NameTypeDescription
merchant_idIntegerIn response, you can see the merchant ID which you have sent as one of the parameters in Pine Labs payment gateway API request parameters.
merchant_access_codeStringIn response, you can find the merchant access code which you have sent as one of the parameters.
pine_pg_txn_statusIntegerTransaction status.
txn_completion_date_timeDateTimeThe date-time of the transaction completion at Pine Labs payment gateway server.
amount_in_paisaLongIt is the amount for which payment transaction is being done.
txn_response_codeIntegerRepresent the response of the API request and response code is returned based on the transaction result.
txn_response_msgStringTransaction response message.
acquirer_nameStringAcquirer Bank.
pine_pg_transaction_idLongUnique transaction id generated by Pine Labs.
payment_modeIntegerPayment mode chosen at landing page.
is_bank_emi_txnBoolFlag to indicate Bank EMI transaction.
is_brand_emi_txnBoolFlag to indicate Brand EMI transaction.
emi_tenure_monthIntegerTenure month of EMI transaction.
emi_principal_amount_in_paisaLongPrincipal EMI amount in Paise.
emi_amount_payable_each_month_in_paisaLongMonthly Installment.
emi_interest_rate_percentIntegerInterest rate charged by bank multiplied by 10000.
emi_cashback_typeIntegerIts value will be 0, 1,2 and 3. 0- Standard EMI, 1- Pre cash back, 2- Post cash back, 3- Instant Cashback
emi_total_discount_cashback_amount_in_paisaLongTotal discount or cashback amount applicable in EMI transaction in paise.
emi_total_discount_cashback_percentIntegerTotal discount or cashback percent applicable in EMI transaction multiplied by 10000.
emi_merchant_discount_cashabck_perecentIntegerMerchant discount or cashback percent applicable in EMI transaction multiplied by 10000.
emi_merchant_discount_cashback_fixed_amount_in_paisaLongMerchant fixed discount or cashback amount applicable in EMI transaction in paise.
emi_issuer_discount_cashabck_perecentIntegerIssuer discount or cashback percent applicable in EMI transaction multiplied by 10000.
emi_issuer_discount_cashback_fixed_amount_in_paisaLongIssuer fixed discount or cashback amount applicable in EMI transaction in paise.
emi_additional_cashbackStringAdditional Cashback in case of EMI Transaction
txn_additional_infoStringBase64 encoded string
merchant_return_urlStringMerchant return URL
emi_processing_feeLongProcessing fee amount in paise.
manufacturerStringManufacturer name in case of brand emi transaction
product_categoryStringProduct category in case of brand emi transaction
product_descriptionStringProduct description in case of brand emi transaction
product_discountLongProduct discount in case of brand emi transaction. It is the flat discount given on product
captured_amount_in_paisaLongCaptured amount for a transaction
refund_amount_in_paisaLongRefund amount for a transasction
parent_txn_statusIntegerParent txn status
parent_txn_response_codeIntegerParent txn response code
parent_txn_response_messageStringParent txn response message
issuer_nameStringIssuing bank name
udf_field_1StringUdf field1 which comes in payment initiation request
udf_field_2StringUdf field2 which comes in payment initiation request
udf_field_3StringUdf field3 which comes in payment initiation request
udf_field_4StringUdf field4 which comes in payment initiation request
card_holder_nameStringCard holder name in case of card transaction
salted_card_hashStringSalted card hash in case of card transaction
masked_card_numberStringMasked Card number in case of card transaction
auth_codeStringAuth code received from acquirer in authorization response
rrnStringRRN number received from acquirer in authorization response
Acquirer_Response_CodeStringAcquirer response code received from acquirer in authorization response
Acquirer_Response_MessageStringAcquirer response message received from acquirer in authorization response
is_surcharge_txnInteger1 value will be come if transaction is convenience fee else 0
convenience_fees_in_paiseLongTotal convenience fees applied on transaction
convenience_gst_in_paiseLongTotal convenience fees GST applied on transaction
convenience_additional_charges_in_paiseLongTotal convenience fees additional fees applied on transaction
auth_idStringAuth ID received in authorization response

Signature Verification

This is a mandatory step to confirm the authenticity of the details returned to you on the return URL for successful payments. Refer to the steps below to ensure that the data is authentic and not tampered with.

To find the signature refer to the header X-verify in the response parameters.

x - verify{{ FF0014009BE78864DA6880349F1F2D273DE6920B4480B65C3EF8D20A76990409}}  

Sample Response

{ 
"event_name": "payment.captured",
"merchant_response": {
"merchant_id": "113484",
"merchant_access_code": "7f532770-f8a7-46f8-a463-182727a29350",
"unique_merchant_txn_id": "104943038807791693",
"pine_pg_txn_status": "4",
"txn_completion_date_time": "29/11/2023 12:18:49 PM",
"amount_in_paisa": "20000",
"txn_response_code": "1",
"txn_response_msg": "SUCCESS",
"acquirer_name": "HDFC",
"pine_pg_transaction_id": "7831007",
"captured_amount_in_paisa": "20188",
"refund_amount_in_paisa": "0",
"payment_mode": "CREDIT_DEBIT_CARD",
"parent_txn_status": "",
"parent_txn_response_code": "",
"parent_txn_response_message": "",
"masked_card_number": "************1112",
"card_holder_name": "mojiz",
"salted_card_hash": "B6B6A7CE1E6E2AA0DD7C028385446A3BBADCEE026A283859C69F5D2B8CC645AD",
"rrn": "425847096720",
"auth_code": "999999"
}
}

Step 1: Convert the response into CSV without spaces:

{"event_name":"payment.captured","merchant_response":{"merchant_id":"113484","merchant_access_code":"7f532770-f8a7-
46f8-a463-
182727a29350","unique_merchant_txn_id":"104943038807791693","pine_pg_txn_status":"4","txn_completion_date_time":"29/
11/2023 12:18:49
PM","amount_in_paisa":"20000","txn_response_code":"1","txn_response_msg":"SUCCESS","acquirer_name":"HDFC","pine_pg_tr ansaction_id":"7831007","captured_amount_in_paisa":"20188","refund_amount_in_paisa":"0","payment_mode":"CREDIT_DEBIT _CARD","parent_txn_status":"","parent_txn_response_code":"","parent_txn_response_message":"","masked_card_number":"**
**********1112","card_holder_name":"mojiz","salted_card_hash":"B6B6A7CE1E6E2AA0DD7C028385446A3BBADCEE026A28385
9C69F5D2B8CC645AD","rrn":"425847096720","auth_code":"999999"}}

Step 2: Convert the payload into base64 format:

eyJldmVudF9uYW1lIjoicGF5bWVudC5jYXB0dXJlZCIsIm1lcmNoYW50X3Jlc3BvbnNlIjp7Im1lcmNoYW50X2lkIjoiMTEzNDg0IiwibWVyY 2hhbnRfYWNjZXNzX2NvZGUiOiI3ZjUzMjc3MC1mOGE3LTQ2ZjgtYTQ2My0xODI3MjdhMjkzNTAiLCJ1bmlxdWVfbWVyY2hhbnRfdHhu
X2lkIjoiMTA0OTQzMDM4ODA3NzkxNjkzIiwicGluZV9wZ190eG5fc3RhdHVzIjoiNCIsInR4bl9jb21wbGV0aW9uX2RhdGVfdGltZSI6IjI5Lz
ExLzIwMjMgMTI6MTg6NDkgUE0iLCJhbW91bnRfaW5fcGFpc2EiOiIyMDAwMCIsInR4bl9yZXNwb25zZV9jb2RlIjoiMSIsInR4bl9yZXNwb 25zZV9tc2ciOiJTVUNDRVNTIiwiYWNxdWlyZXJfbmFtZSI6IkhERkMiLCJwaW5lX3BnX3RyYW5zYWN0aW9uX2lkIjoiNzgzMTAwNyIsImN hcHR1cmVkX2Ftb3VudF9pbl9wYWlzYSI6IjIwMTg4IiwicmVmdW5kX2Ftb3VudF9pbl9wYWlzYSI6IjAiLCJwYXltZW50X21vZGUiOiJDUkV ESVRfREVCSVRfQ0FSRCIsInBhcmVudF90eG5fc3RhdHVzIjoiIiwicGFyZW50X3R4bl9yZXNwb25zZV9jb2RlIjoiIiwicGFyZW50X3R4bl9yZX Nwb25zZV9tZXNzYWdlIjoiIiwibWFza2VkX2NhcmRfbnVtYmVyIjoiKioqKioqKioqKioqMTExMiIsImNhcmRfaG9sZGVyX25hbWUiOiJtb2 ppeiIsInNhbHRlZF9jYXJkX2hhc2giOiJCNkI2QTdDRTFFNkUyQUEwREQ3QzAyODM4NTQ0NkEzQkJBRENFRTAyNkEyODM4NTlDNjlGN UQyQjhDQzY0NUFEIiwicnJuIjoiNDI1ODQ3MDk2NzIwIiwiYXV0aF9jb2RlIjoiOTk5OTk5In19

Step 3: Hashing the payload Pass the base64 payload through SHA256 algorithm along with the MID secret to generate the signature.

FF0014009BE78864DA6880349F1F2D273DE6920B4480B65C3EF8D20A76990409 

Step 4: Match the generated signature with the received signature in the x-verify header