From f64da28b0a42006e9356c0de1eda2c0a35addcb7 Mon Sep 17 00:00:00 2001 From: seunex17 Date: Tue, 5 Nov 2024 15:18:47 +0100 Subject: [PATCH] add redirect ioption to standard payment --- src/Flutterwave/CollectPayment.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Flutterwave/CollectPayment.php b/src/Flutterwave/CollectPayment.php index f3a9896..0b40017 100644 --- a/src/Flutterwave/CollectPayment.php +++ b/src/Flutterwave/CollectPayment.php @@ -15,7 +15,7 @@ class CollectPayment extends FlutterwaveConfig /** * @throws Exception */ - public static function standard(array $data): RedirectResponse + public static function standard(array $data, bool $redirect = true) { $client = Services::curlrequest(); $config = new Flutterwave(); @@ -50,7 +50,12 @@ public static function standard(array $data): RedirectResponse throw new Exception($response->message); } - return redirect()->to($response->data->link); + if ($redirect) + { + return redirect()->to($response->data->link); + } + + return json_encode($response); } /**