From 078578c2b498f5cc6ccf6d989b92d67d07f78b19 Mon Sep 17 00:00:00 2001 From: Chiedu Emmanuel Date: Thu, 10 Sep 2020 20:10:30 +0100 Subject: [PATCH 1/2] added method to charge returning customers using their authorization code --- src/Paystack.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Paystack.php b/src/Paystack.php index 0aa42dc..169ebac 100644 --- a/src/Paystack.php +++ b/src/Paystack.php @@ -546,6 +546,23 @@ public function fetchSubscription($subscription_id) return $this->setHttpResponse('/subscription/'.$subscription_id, 'GET', [])->getResponse(); } + /** + * Charge returning customers + * Used for reccurring charges + */ + public function chargeAuthorizedCard() + { + $data = [ + "authorization_code" => request()->name, + "email" => request()->email, + "amount" => intval(request()->amount), + ]; + + $this->setRequestOptions(); + + return $this->setHttpResponse("/transaction/charge_authorization", 'POST', $data)->getResponse(); + } + /** * Create pages you can share with users using the returned slug */ From 1164f9a0f47b0715939ef114179e8befd28df383 Mon Sep 17 00:00:00 2001 From: Chiedu Emmanuel Date: Thu, 10 Sep 2020 22:20:52 +0100 Subject: [PATCH 2/2] fixed authorization code mapping --- src/Paystack.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Paystack.php b/src/Paystack.php index 169ebac..cac1a96 100644 --- a/src/Paystack.php +++ b/src/Paystack.php @@ -553,7 +553,7 @@ public function fetchSubscription($subscription_id) public function chargeAuthorizedCard() { $data = [ - "authorization_code" => request()->name, + "authorization_code" => request()->authorization_code, "email" => request()->email, "amount" => intval(request()->amount), ];