| @@ 447-458 (lines=12) @@ | ||
| 444 | /** |
|
| 445 | * Create a subscription to a plan from a customer. |
|
| 446 | */ |
|
| 447 | public function createSubscription() |
|
| 448 | { |
|
| 449 | $data = [ |
|
| 450 | "customer" => request()->customer, //Customer email or code |
|
| 451 | "plan" => request()->plan, |
|
| 452 | "authorization" => request()->authorization_code |
|
| 453 | ]; |
|
| 454 | ||
| 455 | $this->setRequestOptions(); |
|
| 456 | $this->setHttpResponse('/subscription', 'POST', $data); |
|
| 457 | } |
|
| 458 | ||
| 459 | /** |
|
| 460 | * Get all the subscriptions made on Paystack. |
|
| 461 | * |
|
| @@ 501-512 (lines=12) @@ | ||
| 498 | * Enable a subscription using the subscription code and token |
|
| 499 | * @return array |
|
| 500 | */ |
|
| 501 | public function enableSubscription() |
|
| 502 | { |
|
| 503 | $data = [ |
|
| 504 | "code" => request()->code, |
|
| 505 | "token" => request()->token, |
|
| 506 | ]; |
|
| 507 | ||
| 508 | $this->setRequestOptions(); |
|
| 509 | return $this->setHttpResponse('/subscription/enable', 'POST', $data)->getResponse(); |
|
| 510 | } |
|
| 511 | ||
| 512 | /** |
|
| 513 | * Disable a subscription using the subscription code and token |
|
| 514 | * @return array |
|
| 515 | */ |
|
| @@ 516-527 (lines=12) @@ | ||
| 513 | * Disable a subscription using the subscription code and token |
|
| 514 | * @return array |
|
| 515 | */ |
|
| 516 | public function disableSubscription() |
|
| 517 | { |
|
| 518 | $data = [ |
|
| 519 | "code" => request()->code, |
|
| 520 | "token" => request()->token, |
|
| 521 | ]; |
|
| 522 | ||
| 523 | $this->setRequestOptions(); |
|
| 524 | return $this->setHttpResponse('/subscription/disable', 'POST', $data)->getResponse(); |
|
| 525 | } |
|
| 526 | ||
| 527 | /** |
|
| 528 | * Fetch details about a certain subscription |
|
| 529 | * @param mixed $subscription_id |
|
| 530 | * @return array |
|
| @@ 541-553 (lines=13) @@ | ||
| 538 | /** |
|
| 539 | * Create pages you can share with users using the returned slug |
|
| 540 | */ |
|
| 541 | public function createPage() |
|
| 542 | { |
|
| 543 | $data = [ |
|
| 544 | "name" => request()->name, |
|
| 545 | "description" => request()->description, |
|
| 546 | "amount" => request()->amount |
|
| 547 | ]; |
|
| 548 | ||
| 549 | $this->setRequestOptions(); |
|
| 550 | $this->setHttpResponse('/page', 'POST', $data); |
|
| 551 | } |
|
| 552 | ||
| 553 | /** |
|
| 554 | * Fetches all the pages the merchant has |
|
| 555 | * @return array |
|
| 556 | */ |
|
| @@ 579-591 (lines=13) @@ | ||
| 576 | * @param $page_id |
|
| 577 | * @return array |
|
| 578 | */ |
|
| 579 | public function updatePage($page_id) |
|
| 580 | { |
|
| 581 | $data = [ |
|
| 582 | "name" => request()->name, |
|
| 583 | "description" => request()->description, |
|
| 584 | "amount" => request()->amount |
|
| 585 | ]; |
|
| 586 | ||
| 587 | $this->setRequestOptions(); |
|
| 588 | return $this->setHttpResponse('/page/'.$page_id, 'PUT', $data)->getResponse(); |
|
| 589 | } |
|
| 590 | ||
| 591 | /** |
|
| 592 | * Creates a subaccount to be used for split payments . Required params are business_name , settlement_bank , account_number , percentage_charge |
|
| 593 | * |
|
| 594 | * @return array |
|