Answer the question
In order to leave comments, you need to log in
How to connect notifications from Yandex money?
The site on yii2, made the usual form of payment through Yandex money. All rules pass. But you need to accept a notification via http about successful payment.
https://money.yandex.ru/myservices/online.xml here indicated the site " http://test.ru/balance/transaction/ya-create " indicated that it was necessary to notify. But after payment in general, nothing comes to this page. Did the usual check with a record in the database.
if ($_POST && $_POST['notification_type'])
$sha1 = sha1( $_POST['notification_type'] . '&' .
$_POST['operation_id']. '&' .
$_POST['amount'] . '&643&' .
$_POST['datetime'] . '&'.
$_POST['sender'] . '&' .
$_POST['codepro'] . '&' .
$secret_key. '&' .
$_POST['label'] );
else
$sha1 = null;
if ($_POST && $_POST['sha1_hash'] && $sha1 == $_POST['sha1_hash']) {
$model = new Transaction();
$model->balance_id = Yii::$app->user->identity->id;
$model->type = 'in';
$model->amount = $_POST['amount'];
$model->refill_type = '1';
$model->comment = $_POST['comment'];
$model->save;
} else {
$model = new Transaction();
$model->balance_id = 1;
$model->type = 'out';
$model->amount = 60;
$model->refill_type = '1';
$model->comment = 'Коммент';
$model->save;
}
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