Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkNotificationSignature false каждый раз #26

Open
Fayozjon opened this issue Feb 6, 2022 · 1 comment
Open

checkNotificationSignature false каждый раз #26

Fayozjon opened this issue Feb 6, 2022 · 1 comment

Comments

@Fayozjon
Copy link

Fayozjon commented Feb 6, 2022

Всем привет пытаюсь проверить хеш с заголовка
выдает false

$billPayments = new BillPayments(env("QIWI_SECRET"));


        $head = getallheaders(); 
        $sha256_hash_header = $head['X-Api-Signature-Sha256']; 
        $notificationData = [
            'bill' => [
                'siteId' =>  $request->input('bill.siteId'),
                'billId' => $request->input('bill.billId'),
                'amount' => [
                    'value' =>  $request->input('bill.amount.value'),
                    'currency' => $request->input('bill.amount.currency')
                    ],
                    'status' => [
                        'value' => $request->input('bill.status.value')
                    ]
            ],
            'version' => $request->input('version')
          ];  

        $check = $billPayments->checkNotificationSignature(
            $sha256_hash_header, $notificationData, base64_decode(env("QIWI_SECRET"))
        );  

Результат

$check === false;
@Lucifer2033
Copy link

Lucifer2033 commented Aug 8, 2022

у меня так работает

$secretKey = QSTOKEN;

$billPayments = new Qiwi\Api\BillPayments($secretKey);

//получем тело ответа

$postbody = json_decode(file_get_contents('php://input'),true);

$notificationData = [
    'bill' => [
      'siteId' => $postbody['bill']['siteId'],
      'billId' => $postbody['bill']['billId'],
      'amount' => ['value' => $postbody['bill']['amount']['value'], 'currency' => 'RUB'],
      'status' => ['value' => $postbody['bill']['status']['value']]
    ],
    'version' => $postbody['version']
];

//получем заголовки ответа
$headers = apache_request_headers();

$validSignatureFromNotificationServer = $headers['X-Api-Signature-SHA256'];

//проверяем подпись

$checksigna = $billPayments->checkNotificationSignature($validSignatureFromNotificationServer,$notificationData,$secretKey);

обновил у меня работает как у вас не знаю

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants