Skip to main content

Callback

Let's discover Callback in less than 2 minutes.

Getting Started

To receive transaction callbacks, update your dashboard's callback URL and follow the decryption algorithm provided in the dashboard.

What is a Payment Callback?

A payment callback is a mechanism where a payment gateway sends real-time updates to a specified URL on the merchant's server. These updates are typically about the status of a payment transaction, such as whether it was successful, failed, or pending. This allows the merchant to automatically process the payment information without the need for the user to manually return to the site or for the merchant to poll the payment gateway for updates.

How It Works

Transaction Initiation:

A customer initiates a payment on the merchant's website or app. The merchant's system sends the payment details to the payment gateway for processing.

Payment Processing:

The payment gateway processes the payment through various means (e.g., credit card, UPI, bank transfer). The gateway will attempt to authorize and complete the payment.

Callback Notification:

Once the payment processing is completed (successfully or not), the payment gateway sends a POST request to the merchant's specified callback URL. This request contains details about the transaction, such as transaction ID, status, amount, and any other relevant information.

Merchant's Server Handling:

The merchant's server receives the callback request. The server typically verifies the authenticity and integrity of the data (e.g., by decrypting the data if encrypted). Based on the transaction status, the server updates the order status in the merchant's database and performs any necessary business logic (e.g., sending a confirmation email to the customer).

Format

Callback Format
{
"transaction_id": "123xyz",
"status": "success || failed",
"amount": 10,
"date": "2023-10-27T08:43:27.709Z",
"utr": "123xyz",
"merchant_ref_no":"4777382",
"encryptedData": "xyzllsndkwl=="
}

Description of Callback Parameters

  • transaction_id: The unique identifier for the transaction.
  • status: The status of the transaction, either success or failed.
  • amount: The amount involved in the transaction.
  • date: The date and time when the transaction occurred, in ISO 8601 format.
  • utr: Unique Transaction Reference number for the transaction.
  • merchant_ref_no: Unique Transaction Reference number passed by merchant for the transaction.
  • encryptedData: The encrypted data related to the transaction details.

Decryption of response data

To verify your transaction , you can decrypt the encryptedData property of the callback object using your encryption key.You can get the encryption key from your dashboard.

Decryption Algorithm
//Algorithm for decryption:
function decryptParameters(input,secretKey){
const decryptedBytes = CryptoJS.AES.decrypt(input, secretKey);
const decryptedData = decryptedBytes.toString(CryptoJS.enc.Utf8);
return decryptedData;
}

//You can convert this function to the language of your choice

Notes

  • Make sure your server endpoint is configured to handle incoming POST requests at the callback URL.
  • Use the encryption key provided in your dashboard to decrypt the encryptedData.
  • Always validate the decrypted data to ensure the integrity and authenticity of the transaction details.

By following this documentation, you can set up and use the Callback API effectively to receive real-time transaction updates.