N
N
Nikita Zelikov2021-03-27 21:34:10
PHP
Nikita Zelikov, 2021-03-27 21:34:10

Notification from kiwi does not come, what's wrong?

No notification after payment. what is wrong in my code?
I ask you not to write about the documentation, this is not the first time I have read it ...

<?php
require_once __DIR__ . '/vendor/qiwi/bill-payments-php-sdk/src/BillPayments.php';
require_once __DIR__ . '/vendor/curl/curl/src/Curl/Curl.php';



$link=тут подключение к бд


  $secret_key = тут код

  $sha256_hash_header = $_SERVER['HTTP_X_API_SIGNATURE_SHA256']; // Получаю заголовок

  $entity_body = file_get_contents('php://input');  // Декодирую тело входящего запроса
  $array_body = json_decode($entity_body, true);           // в обычный массив

  $amount_currency = $array_body['bill']['amount']['currency'];
  $balans = $array_body['bill']['amount']['value'];
  $billId = $array_body['bill']['billId'];
  $siteId = $array_body['bill']['siteId'];
  $status_value = $array_body['bill']['status']['value'];
  $login = $array_body['bill']['customer']['account'];
  $ref = $array_body['bill']['comment'];

  $invoice_parameters = $amount_currency."|".$balans."|".$billId."|".$siteId."|".$status_value."|".$login."|".$ref;

  $sha256_hash = hash_hmac('sha256', $invoice_parameters, base64_decode($secret_key));

  if (!empty($sha256_hash_header) && strcmp($sha256_hash_header, $sha256_hash) === 0) {
    // выполняю какой-то код, если все верно
  } 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 question

Ask a Question

731 491 924 answers to any question