Skip to content

Commit 2ddaf7d

Browse files
author
Prosper Otemuyiwa
authored
Merge pull request #15 from ammezie/master
add method to get all subscriptions made
2 parents 6219066 + d35b9c0 commit 2ddaf7d

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

src/Paystack.php

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function makePaymentRequest()
127127
*
128128
* ]
129129
*/
130-
'metadata' => request()->metadata
130+
'metadata' => request()->metadata
131131
];
132132

133133
// Remove the fields which were not sent (value would be null)
@@ -319,7 +319,6 @@ public function createPlan()
319319
$this->setRequestOptions();
320320

321321
$this->setHttpResponse("/plan", 'POST', $data);
322-
323322
}
324323

325324
/**
@@ -434,6 +433,44 @@ public function createSubscription()
434433
$this->setHttpResponse('/subscription', 'POST', $data);
435434
}
436435

436+
/**
437+
* Get all the subscriptions made on Paystack.
438+
*
439+
* @return array
440+
*/
441+
public function getAllSubscriptions()
442+
{
443+
$this->setRequestOptions();
444+
445+
return $this->setHttpResponse("/subscription", 'GET', [])->getData();
446+
}
447+
448+
/**
449+
* Get customer subscriptions
450+
*
451+
* @param integer $customer_id
452+
* @return array
453+
*/
454+
public function getCustomerSubscriptions($customer_id)
455+
{
456+
$this->setRequestOptions();
457+
458+
return $this->setHttpResponse('/subscription?customer=' . $customer_id, 'GET', [])->getData();
459+
}
460+
461+
/**
462+
* Get plan subscriptions
463+
*
464+
* @param integer $plan_id
465+
* @return array
466+
*/
467+
public function getPlanSubscriptions($plan_id)
468+
{
469+
$this->setRequestOptions();
470+
471+
return $this->setHttpResponse('/subscription?plan=' . $plan_id, 'GET', [])->getData();
472+
}
473+
437474
/**
438475
* Enable a subscription using the subscription code and token
439476
* @return array

0 commit comments

Comments
 (0)