/** * Handles response from Gopay Payment Gate * * @param int $orderId * @param string $paymentSessionId * @param string $targetGoId * @param int $orderNumber * @param string $encryptedSignature */ public function actionSuccess($orderId, $paymentSessionId, $targetGoId, $orderNumber, $encryptedSignature) { // your custom communication with model $order = $this->model->findOrderByPaymentId($paymentSessionId); // restores Payment object (as instance of ReturnedPayment) $payment = $this->paymentService->restorePayment(['sum' => $order->price, 'variable' => $order->varSymbol, 'specific' => $order->specSymbol, 'productName' => $order->product], ['paymentSessionId' => $paymentSessionId, 'targetGoId' => $targetGoId, 'orderNumber' => $orderNumber, 'encryptedSignature' => $encryptedSignature]); // firstly we check if request is not falsified if ($payment->isFraud()) { $this->redirect('fraud'); } // secondly we check if request really means the Payment is paid if ($payment->isPaid()) { // store information in our model - SUCCESSFUL END!!! $order->markAsPaid(); } else { $this->redirect('failure'); } echo 'Paid!'; }