Re-Send Webhook API Integration
Webhook API Integration
This section contains your RESTful API to resend Webhook Notification.
Re-Send Webhook API Integration
Webhook API Integration
This section contains your RESTful API to resend Webhook Notification.
The VTU Africa API uses API Key for Authentication.
Please use your APIKEY for authentication
Base URL: https://vtuafrica.com.ng/portal/api/merchant-verify/
Parameters: as specified in the parameters below:
| PARAMETERS | Required/Optional | TYPE | DESCRIPTION |
| apikey | R | String | The reseller gateway API key created at www.vtuafrica.com.ng |
| serviceName | R | String | This is the Name of the service you are performing. In this case it is: Webhook |
| ref | R | String | This is the unique ReferenceID of the transaction you want to resend |
| webhookURL | O | URL | This is a webhook URL where the notification will be resent. If not provided, the webhook in your profile will be used. Please include http:// or https:// |
SAMPLE CODE
$host ="https://www.vtuafrica.com.ng/portal/api/merchant-verify/?apikey=1234&serviceName=Webhook&ref=123456789&webhookURL=https://testing.com/webhook/";
//Initialize cURL.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $host);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
// Set custom headers (OPTIONAL)
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/json, text/plain, */*'
]);
// Set the User-Agent
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36');
$data = curl_exec($ch);
//Close the cURL handle.
curl_close($ch);
$response = json_decode($data);
EXPECTED RESPONSE
{"code":101,"description":{"Status":"Completed","ref":"8687391176","service":"Exam PIN","network":"serviceID","ProductName":"NECO Result Checking TOKENs","quantity":3,"pins":"940972691411,940972691412","Token":"940972691411,940972691412","downloadLink":"https://vtuafrica.com.ng/portal/transaction-history/print.php?ref=8687391176","amount":"2150","debit":"6450","credit":"0","charge":"0","comi":"","channel":"API","Previous_Balance":"10,456.42","After_Balance":"4,006.42","Current_Balance":"10,756.42","dateTime":"3 October 2026, 02:31 PM","message":"The Transaction was Completed Successfully",""webhookStatus":"Completed","webhookResponse":"Webhook Data Sent received"}}
EXPECTED WEBHOOK PAYLOAD
{"ref":"8687391176","service":"Exam PIN","network":"serviceID","ProductName":"NECO Result Checking TOKENs","quantity":3,"pins":"940972691411,940972691412","Token":"940972691411,940972691412","downloadLink":"https://vtuafrica.com.ng/portal/transaction-history/print.php?ref=8687391176","status":"Completed","amount":"2150","debit":"6450","credit":"0","charge":"0","comi":"","channel":"API","Previous_Balance":"10,456.42","After_Balance":"4,006.42","Current_Balance":"10,756.42","dateTime":"3 October 2026, 02:31 PM","message":"The Transaction was Completed Successfully"}
PHP Implementation Example
// 1. Get the raw POST payload
$payload = file_get_contents('php://input');
// 2. Retrieve the signature from the Authorization header
$headers = getallheaders();
$received_signature = $headers['Authorization'] ?? '';
// If getallheaders() is unavailable on your server, use this fallback:
// $received_signature = $_SERVER['HTTP_AUTHORIZATION'] ?? '';
// 3. Your private API Key (Keep this secret and load it from your environment variables)
$api_key = "YOUR_API_KEY";
// 4. Calculate the expected signature
$expected_signature = hash_hmac('sha256', $payload, $api_key);
// 5. Securely compare the signatures (using hash_equals to prevent timing attacks)
if (hash_equals($expected_signature, $received_signature)) {
// Signature is valid! Process the webhook event safely.
http_response_code(200);
echo json_encode(["status" => "success"]);
} else {
// Signature mismatch! Reject the request.
http_response_code(401);
echo json_encode(["error" => "Invalid signature"]);
exit;
}