Skip to content

Commit fc0eef2

Browse files
author
Okubanjo Oluwafunsho
committed
Add support to create plans
This was implemented based on the PayStack documentation
1 parent 4b40fd1 commit fc0eef2

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
build
22
vendor
33
.DS_Store
4-
composer.lock
4+
composer.lock
5+
.idea

src/Paystack.php

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ public function isTransactionVerificationValid()
188188

189189
/**
190190
* Get Payment details if the transaction was verified successfully
191-
* @throws Unicodeveloper\Paystack\Exceptions\PaymentVerificationFailedException
192191
* @return json
192+
* @throws PaymentVerificationFailedException
193193
*/
194194
public function getPaymentData()
195195
{
@@ -278,4 +278,36 @@ private function getData()
278278
return $this->getResponse()['data'];
279279
}
280280

281-
}
281+
//Edits by Funsho http://devfunsho.com | @iamfusnho - 22/05/2016
282+
283+
/**
284+
* Create a plan
285+
* @return array
286+
*/
287+
public function createPlan(){
288+
289+
$data = [
290+
291+
"name" => request()->name,
292+
"description" => request()->desc,
293+
"amount" => intval(request()->amount),
294+
"interval" => request()->interval,
295+
"send_invoices" => request()->send_invoices,
296+
"send_sms" => request()->send_sms,
297+
"currency" => request()->currency,
298+
];
299+
300+
$this->setRequestOptions();
301+
302+
$this->response = $this->client->post($this->baseUrl .'/plan', [
303+
'body' => json_encode($data)
304+
]);
305+
306+
return $this->response->getResponse();
307+
308+
}
309+
310+
}
311+
312+
313+

0 commit comments

Comments
 (0)