Answer the question
In order to leave comments, you need to log in
Why does Yandex send an incomprehensible response in the http notification from the payment?
Hello. I ran into such a problem, I want to accept payments on my site, I send myself a test notification about the payment, Yandex sends me a response in a format I don’t understand, I don’t understand why.
Handler Example
$secret = '000000000000000000000000';
$r = array(
'notification_type' => $_POST['notification_type'],
'operation_id' => $_POST['operation_id'],
'amount' => $_POST['amount'],
'withdraw_amount' => $_POST['withdraw_amount'],
'currency' => $_POST['intval'],
'datetime' => $_POST['datetime'],
'sender' => $_POST['sender'],
'codepro' => $_POST['codepro'],
'label' => $_POST['label'],
'sha1_hash' => $_POST['sha1_hash']
);
if (sha1($r['notification_type'].'&'.
$r['operation_id'].'&'.
$r['amount'].'&'.
$r['currency'].'&'.
$r['datetime'].'&'.
$r['sender'].'&'.
$r['codepro'].'&'.
$secret.'&'.
$r['label']) != $r['sha1_hash']) {
exit('Верификация не пройдена. SHA1_HASH не совпадает.');
}
file_put_contents('history.php', $r . PHP_EOL , FILE_APPEND);
a:1:{i:0;a:11:{s:17:"notification_type";s:12:"p2p-incoming";s:6:"amount";s:6:"343.83";s:8:"datetime";s:20:"2017-03-22T07:34:08Z";s:7:"codepro";s:5:"false";s:6:"sender";s:11:"41001000040";s:9:"sha1_hash";s:40:"ab0760f1a82db2bd56ab897b9d8b3090803a8a24";s:17:"test_notification";s:4:"true";s:15:"operation_label";s:0:"";s:12:"operation_id";s:17:"test-notification";s:8:"currency";s:3:"643";s:5:"label";s:0:"";}}
a:1:{i:0;a:11:{s:17:"notification_type";s:12:"p2p-incoming";s:6:"amount";s:6:"343.83";s:8:"datetime";s:20:"2017-03-22T07:34:08Z";s:7:"codepro";s:5:"false";s:6:"sender";s:11:"41001000040";s:9:"sha1_hash";s:40:"ab0760f1a82db2bd56ab897b9d8b3090803a8a24";s:17:"test_notification";s:4:"true";s:15:"operation_label";s:0:"";s:12:"operation_id";s:17:"test-notification";s:8:"currency";s:3:"643";s:5:"label";s:0:"";}}
$data = unserialize('a:1:{i:0;a:11:{s:17:"notification_type";s:12:"p2p-incoming";s:6:"amount";s:6:"475.02";s:8:"datetime";s:20:"2017-03-22T07:57:29Z";s:7:"codepro";s:5:"false";s:6:"sender";s:11:"41001000040";s:9:"sha1_hash";s:40:"cfff3e99ad82fe74802802a4cb7d8838f69440ae";s:17:"test_notification";s:4:"true";s:15:"operation_label";s:0:"";s:12:"operation_id";s:17:"test-notification";s:8:"currency";s:3:"643";s:5:"label";s:0:"";}}');
echo "<pre>";
print_r($data);
echo "</pre>";
Array
(
[0] => Array
(
[notification_type] => p2p-incoming
[amount] => 475.02
[datetime] => 2017-03-22T07:57:29Z
[codepro] => false
[sender] => 41001000040
[sha1_hash] => cfff3e99ad82fe74802802a4cb7d8838f69440ae
[test_notification] => true
[operation_label] =>
[operation_id] => test-notification
[currency] => 643
[label] =>
)
)
$data = unserialize($r);
file_put_contents('history.php', $data[0]['sender'] . PHP_EOL , FILE_APPEND);
a:1:{i:0;a:11:{s:17:"notification_type";s:12:"p2p-incoming";s:6:"amount";s:6:"475.02";s:8:"datetime";s:20:"2017-03-22T07:57:29Z";s:7:"codepro";s:5:"false";s:6:"sender";s:11:"41001000040";s:9:"sha1_hash";s:40:"cfff3e99ad82fe74802802a4cb7d8838f69440ae";s:17:"test_notification";s:4:"true";s:15:"operation_label";s:0:"";s:12:"operation_id";s:17:"test-notification";s:8:"currency";s:3:"643";s:5:"label";s:0:"";}}
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