Note
Ensure that you include the webhook URL in the 'webhook_url' parameter when making a request to the Create Charge API.
<?php
$rawData = file_get_contents("php://input");
$data = json_decode($rawData, true);
$received_api_key = getAuthorizationHeader();
if ($received_api_key !== 'API_KEY') {
http_response_code(401);
echo json_encode(["status" => false, "message" => "Unauthorized request.".$received_api_key]);
exit;
}
$pp_id = $data['pp_id'] ?? '';
$customer_name = $data['customer_name'] ?? '';
$customer_email_mobile = $data['customer_email_mobile'] ?? '';
$payment_method = $data['payment_method'] ?? '';
$amount = $data['amount'] ?? 0;
$fee = $data['fee'] ?? 0;
$refund_amount = $data['refund_amount'] ?? 0;
$total = $data['total'] ?? 0;
$currency = $data['currency'] ?? '';
$status = $data['status'] ?? '';
$date = $data['date'] ?? '';
$metadata = $data['metadata'] ?? [];
http_response_code(200);
echo json_encode(['status' => true, 'message' => 'Webhook received']);
{
"pp_id": "--",
"customer_name": "--",
"customer_email_mobile": "--",
"payment_method": "bkash",
"amount": "55",
"fee": "5",
"refund_amount": "0",
"total": 60,
"currency": "BDT",
"metadata": [],
"sender_number": "01655487451",
"transaction_id": "XNFHFGDJFH",
"status": "completed",
"date": "2025-06-10 19:28:04"
}