Answer the question
In order to leave comments, you need to log in
How to get liqpay payment status in yii2?
Created a store on yii2 with payment via liqpay.
Everything is fine, except that it is impossible to figure out how to get the payment status so that the status of the order in the store automatically changes.
Action code with payment:
public function actionView($id)
{
if (!$order = $this->orders->findOwn(\Yii::$app->user->id, $id)) {
throw new NotFoundHttpException('The requested page does not exist.');
}
$liqpay = new LiqPay($this->public_key, $this->private_key);
$html = $liqpay->cnb_form(array(
'action' => 'pay',
'amount' => $order->cost,
'currency' => 'UAH',
'sandbox' => true,
'description' => 'Оплата заказа на Manufacture17.com.ua',
'order_id' => $order->id,
'version' => '3',
'server_url' => 'http://shop.loc/cabinet/order/result'
));
return $this->render('view', [
'order' => $order,
'html' => $html,
]);
}
public function actionResult()
{
var_dump(base64_decode(Yii::$app->request->post('data')));
}
Answer the question
In order to leave comments, you need to log in
error 400
$data = yii\helpers\Json::encode(base64_decode(Yii::$app->request->post('data')));
Yii::info('liqpay',$data)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question