diff --git a/src/Payment/Payment.php b/src/Payment/Payment.php index 1f7dfc2..64f8321 100644 --- a/src/Payment/Payment.php +++ b/src/Payment/Payment.php @@ -45,18 +45,18 @@ private function initPayment($invoice) return $response; } + /** - * Redirect Nagad Payment Checkout Page + * Create payment * * @param float $amount * @param string $invoice * - * @return Application|RedirectResponse|Redirector - * @throws NagadException + * @return mixed * @throws InvalidPrivateKey * @throws InvalidPublicKey + * @throws NagadException */ - public function create($amount, $invoice) { $initialize = $this->initPayment($invoice); @@ -85,9 +85,15 @@ public function create($amount, $invoice) throw new NagadException($response->message); } - if ($response->status == "Success") { - return redirect($response->callBackUrl); - } + return $response; + } + } + + public function executePayment($amount, $invoice) + { + $response = $this->create($amount, $invoice); + if ($response->status == "Success") { + return redirect($response->callBackUrl); } }