label = setting('flutterwave_label'); $this->description = setting('flutterwave_description'); } public function purchase(Order $order, Request $request) { if (!in_array(currency(), self::SUPPORTED_CURRENCIES)) { throw new Exception(trans('payment::messages.currency_not_supported')); } $response = new stdClass(); $response->public_key = setting('flutterwave_public_key'); $response->currency = currency(); $response->order_id = $order->id; $response->amount = $order->total->convertToCurrentCurrency()->amount(); $response->tx_ref = 'ref' . time(); $response->payment_options = self::PAYMENT_OPTIONS; $response->redirect_url = $this->getRedirectUrl($order); return new FlutterwaveResponse($order, $response); } private function getRedirectUrl($order) { return route('checkout.complete.store', ['orderId' => $order->id, 'paymentMethod' => 'flutterwave']); } public function complete(Order $order) { return new FlutterwaveResponse($order, request()->all()); } }