
Webhooks allow your application to receive information about requests, clients and payments events as they occur. This documentation explains how to configure webhooks, how to authenticate, and message formats.
The webhook request is a standard HTTP POST request with a single parameter : data
The data parameter contains a JSON array of webhooks events, up to a maximum of 1 000 events.
A webhook request is initiated about once per minute or every 5 seconds in fast mode (default).
Consider to authenticate that webhooks originated from Paybox Mail's servers by following "Authenticating webhook requests" further down this page.
Every Paybox Mail webhook uses the same general data format.
array(
array(
'event' => 'PaymentrequestsSingleCreate',
'IDrequest' => 'AAAA1234567890123'
),
array(
'event' => 'PaymentrequestsSinglePaid',
'IDrequest' => 'AAAA1234567890123'
),
array(
'event' => 'ClientUpdate',
'IDclient' => 'AAAA1234567890123'
),
...
)
If the webhook url does not return a 200 HTTP response code, the POST request will be re-attempted up to 1 000 times every 10 minutes. After 1 000 attempts (approximately 7 days), the webhook account will be deactivated and webhooks events will be lost. To avoid data loss, we recommend that you accept and store data (with an HTTP 200 response) for later processing.
Paybox Mail signs a webhook request by including X-Auth-Signature, X-Method-Signature and X-Auth-Time HTTP headers, allowing you to check that it comes from our servers.
You need:
webhookKey)fullUrl)jsonData)time)hashMethod) currently 'sha1'toVerify)follow the next steps to generate the signature:
fullUrl, webhookKey, jsonData and time separated by +hashMethod to generate the signature and compare it with toVerifyHere is an example in php:
$headers = getallheaders();
$toVerify = $headers['X-Auth-Signature'];
$hashMethod = $headers['X-Method-Signature'];
$time = $headers['X-Auth-Time'];
$jsonData = $_POST['data'];
$toSign = $fullUrl . '+' . $webhookKey . '+' . $jsonData . '+' . $time;
$signature = hash($hashMethod, $toSign);
if ($signature === $toVerify) {
echo ("successful authentication");
} else {
echo ("failed authentication");
}