Webhook

Webhook will receive the notification instantly after the payment is completed

A webhook is an HTTP-based callback function that allows lightweight, event-driven communication between 2 application programming interfaces (APIs).

❗️

Note

Ensure that you include the webhook URL in the 'webhook_url' parameter when making a request to the Create Payment API.

Example Code

<?php

$secretKey = 'YOUR SECRET KEY';

//Gateway wil send the secret key in request header
//You can verify the request by using this header
$headerKey = $_SERVER['HTTP_X_APP_SECRET'] ?? null;

if(!empty($headerKey) && ($headerKey === $secretKey)) {

	$data = file_get_contents("php://input");

  //Do whatever you want with the data

} ?>

Example Response

{
    "pg_txnid": "EP874574578",
    "merchant_txnid": "SDGS4744SDSFF",
    "amount": "500.00",
    "charge": "10.00",
    "method": "nagad",
    "method_txnid": "71FLE0AJ",
    "meta_data": null,
    "created_at": "2024-02-14 17:48:37",
    "paid_at": "2024-02-15 10:19:03",
    "status": "success"
}

Do not perform any heavy operation in webhook endpoint because it may slow down the verification process.