Answer the question
In order to leave comments, you need to log in
Http notifications of QIWI wallet?
Good day!
Tell me please. I accept payment on the kiwi website, after which http notifications should come to the server, but I can’t understand why the instruction doesn’t work, I used poison before, everything worked clearly there. Here is the Qiwi documentation: Bill payment notifications (there is also an example of an incoming request).
Here is my code:
<?php
$secret_key = 'SECRETSECRETKEYKEY';
$sha256_hash_header = $_SERVER['HTTP_X_API_SIGNATURE_SHA256']; // Получаю заголовок
$entity_body = file_get_contents('php://input'); // Декодирую тело входящего запроса
$array_body = json_decode($entity_body, 1); // в обычный массив
$amount_currency = $array_body['bill']['amount']['currency'];
$amount_value = $array_body['bill']['amount']['value'];
$billId = $array_body['bill']['billId'];
$siteId = $array_body['bill']['siteId'];
$status_value = $array_body['bill']['status']['value'];
$invoice_parameters = $amount_currency . '|' . $amount_value . '|' . $billId . '|' . $siteId . '|' . $status_value;
$sha256_hash = hash_hmac('sha256', $invoice_parameters, $secret_key);
if ($sha256_hash_header == $sha256_hash && !empty($sha256_hash_header)) {
// выполняю какой-то код, если все верно
} else {
http_response_code(404);
die();
}
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question