Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions src/Paystack.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function makePaymentRequest()
*
* ]
*/
'metadata' => request()->metadata
'metadata' => request()->metadata
];

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

$this->setHttpResponse("/plan", 'POST', $data);

}

/**
Expand Down Expand Up @@ -434,6 +433,44 @@ public function createSubscription()
$this->setHttpResponse('/subscription', 'POST', $data);
}

/**
* Get all the subscriptions made on Paystack.
*
* @return array
*/
public function getAllSubscriptions()
{
$this->setRequestOptions();

return $this->setHttpResponse("/subscription", 'GET', [])->getData();
}

/**
* Get customer subscriptions
*
* @param integer $customer_id
* @return array
*/
public function getCustomerSubscriptions($customer_id)
{
$this->setRequestOptions();

return $this->setHttpResponse('/subscription?customer=' . $customer_id, 'GET', [])->getData();
}

/**
* Get plan subscriptions
*
* @param integer $plan_id
* @return array
*/
public function getPlanSubscriptions($plan_id)
{
$this->setRequestOptions();

return $this->setHttpResponse('/subscription?plan=' . $plan_id, 'GET', [])->getData();
}

/**
* Enable a subscription using the subscription code and token
* @return array
Expand Down