| @@ 410-421 (lines=12) @@ | ||
| 407 | /** |
|
| 408 | * Create a subscription to a plan from a customer. |
|
| 409 | */ |
|
| 410 | public function createSubscription() |
|
| 411 | { |
|
| 412 | $data = [ |
|
| 413 | "customer" => request()->customer, //Customer email or code |
|
| 414 | "plan" => request()->plan, |
|
| 415 | "authorization" => request()->authorization_code |
|
| 416 | ]; |
|
| 417 | ||
| 418 | $this->setRequestOptions(); |
|
| 419 | $this->setHttpResponse('/subscription', 'POST', $data); |
|
| 420 | } |
|
| 421 | ||
| 422 | /** |
|
| 423 | * Get all the subscriptions made on Paystack. |
|
| 424 | * |
|
| @@ 464-475 (lines=12) @@ | ||
| 461 | * Enable a subscription using the subscription code and token |
|
| 462 | * @return array |
|
| 463 | */ |
|
| 464 | public function enableSubscription() |
|
| 465 | { |
|
| 466 | $data = [ |
|
| 467 | "code" => request()->code, |
|
| 468 | "token" => request()->token, |
|
| 469 | ]; |
|
| 470 | ||
| 471 | $this->setRequestOptions(); |
|
| 472 | return $this->setHttpResponse('/subscription/enable', 'POST', $data)->getResponse(); |
|
| 473 | } |
|
| 474 | ||
| 475 | /** |
|
| 476 | * Disable a subscription using the subscription code and token |
|
| 477 | * @return array |
|
| 478 | */ |
|
| @@ 479-490 (lines=12) @@ | ||
| 476 | * Disable a subscription using the subscription code and token |
|
| 477 | * @return array |
|
| 478 | */ |
|
| 479 | public function disableSubscription() |
|
| 480 | { |
|
| 481 | $data = [ |
|
| 482 | "code" => request()->code, |
|
| 483 | "token" => request()->token, |
|
| 484 | ]; |
|
| 485 | ||
| 486 | $this->setRequestOptions(); |
|
| 487 | return $this->setHttpResponse('/subscription/disable', 'POST', $data)->getResponse(); |
|
| 488 | } |
|
| 489 | ||
| 490 | /** |
|
| 491 | * Fetch details about a certain subscription |
|
| 492 | * @param mixed $subscription_id |
|
| 493 | * @return array |
|
| @@ 504-516 (lines=13) @@ | ||
| 501 | /** |
|
| 502 | * Create pages you can share with users using the returned slug |
|
| 503 | */ |
|
| 504 | public function createPage() |
|
| 505 | { |
|
| 506 | $data = [ |
|
| 507 | "name" => request()->name, |
|
| 508 | "description" => request()->description, |
|
| 509 | "amount" => request()->amount |
|
| 510 | ]; |
|
| 511 | ||
| 512 | $this->setRequestOptions(); |
|
| 513 | $this->setHttpResponse('/page', 'POST', $data); |
|
| 514 | } |
|
| 515 | ||
| 516 | /** |
|
| 517 | * Fetches all the pages the merchant has |
|
| 518 | * @return array |
|
| 519 | */ |
|
| @@ 542-554 (lines=13) @@ | ||
| 539 | * @param $page_id |
|
| 540 | * @return array |
|
| 541 | */ |
|
| 542 | public function updatePage($page_id) |
|
| 543 | { |
|
| 544 | $data = [ |
|
| 545 | "name" => request()->name, |
|
| 546 | "description" => request()->description, |
|
| 547 | "amount" => request()->amount |
|
| 548 | ]; |
|
| 549 | ||
| 550 | $this->setRequestOptions(); |
|
| 551 | return $this->setHttpResponse('/page/'.$page_id, 'PUT', $data)->getResponse(); |
|
| 552 | } |
|
| 553 | ||
| 554 | /** |
|
| 555 | * Creates a subaccount to be used for split payments . Required params are business_name , settlement_bank , account_number , percentage_charge |
|
| 556 | * |
|
| 557 | * @return array |
|