Skip to content

Commit dd85b21

Browse files
author
Okubanjo Oluwafunsho
committed
Support to Enable and Disable subscription
With this two functions, you can now disable a certain subscription and enable it later if needed.
1 parent 064ad10 commit dd85b21

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/Paystack.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,40 @@ public function createSubscription(){
433433
return $this->setGetResponse('/subscription', $data)->getResponse();
434434
}
435435

436+
/**
437+
* Enable a subscription using the subscription code and token
438+
* @return array
439+
*/
440+
public function enableSubscription(){
441+
442+
$data = [
443+
"code" => request()->code,
444+
"token" => request()->token,
445+
];
446+
447+
$this->setRequestOptions();
448+
449+
return $this->setGetResponse('/subscription/enable', $data)->getResponse();
450+
451+
}
452+
453+
/**
454+
* Disable a subscription using the subscription code and token
455+
* @return array
456+
*/
457+
public function disableSubscription(){
458+
459+
$data = [
460+
"code" => request()->code,
461+
"token" => request()->token,
462+
];
463+
464+
$this->setRequestOptions();
465+
466+
return $this->setGetResponse('/subscription/disable', $data)->getResponse();
467+
468+
}
469+
436470
}
437471

438472

0 commit comments

Comments
 (0)