| 1 |
<?php |
| 2 |
|
| 3 |
// File generated from our OpenAPI spec |
| 4 |
|
| 5 |
namespace Stripe\Service; |
| 6 |
|
| 7 |
class SubscriptionScheduleService extends \Stripe\Service\AbstractService |
| 8 |
{ |
| 9 |
/** |
| 10 |
* Retrieves the list of your subscription schedules. |
| 11 |
* |
| 12 |
* @param null|array $params |
| 13 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 14 |
* |
| 15 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 16 |
* |
| 17 |
* @return \Stripe\Collection<\Stripe\SubscriptionSchedule> |
| 18 |
*/ |
| 19 |
public function all($params = null, $opts = null) |
| 20 |
{ |
| 21 |
return $this->requestCollection('get', '/v1/subscription_schedules', $params, $opts); |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* Cancels a subscription schedule and its associated subscription immediately (if |
| 26 |
* the subscription schedule has an active subscription). A subscription schedule |
| 27 |
* can only be canceled if its status is <code>not_started</code> or |
| 28 |
* <code>active</code>. |
| 29 |
* |
| 30 |
* @param string $id |
| 31 |
* @param null|array $params |
| 32 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 33 |
* |
| 34 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 35 |
* |
| 36 |
* @return \Stripe\SubscriptionSchedule |
| 37 |
*/ |
| 38 |
public function cancel($id, $params = null, $opts = null) |
| 39 |
{ |
| 40 |
return $this->request('post', $this->buildPath('/v1/subscription_schedules/%s/cancel', $id), $params, $opts); |
| 41 |
} |
| 42 |
|
| 43 |
/** |
| 44 |
* Creates a new subscription schedule object. Each customer can have up to 500 |
| 45 |
* active or scheduled subscriptions. |
| 46 |
* |
| 47 |
* @param null|array $params |
| 48 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 49 |
* |
| 50 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 51 |
* |
| 52 |
* @return \Stripe\SubscriptionSchedule |
| 53 |
*/ |
| 54 |
public function create($params = null, $opts = null) |
| 55 |
{ |
| 56 |
return $this->request('post', '/v1/subscription_schedules', $params, $opts); |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* Releases the subscription schedule immediately, which will stop scheduling of |
| 61 |
* its phases, but leave any existing subscription in place. A schedule can only be |
| 62 |
* released if its status is <code>not_started</code> or <code>active</code>. If |
| 63 |
* the subscription schedule is currently associated with a subscription, releasing |
| 64 |
* it will remove its <code>subscription</code> property and set the subscription’s |
| 65 |
* ID to the <code>released_subscription</code> property. |
| 66 |
* |
| 67 |
* @param string $id |
| 68 |
* @param null|array $params |
| 69 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 70 |
* |
| 71 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 72 |
* |
| 73 |
* @return \Stripe\SubscriptionSchedule |
| 74 |
*/ |
| 75 |
public function release($id, $params = null, $opts = null) |
| 76 |
{ |
| 77 |
return $this->request('post', $this->buildPath('/v1/subscription_schedules/%s/release', $id), $params, $opts); |
| 78 |
} |
| 79 |
|
| 80 |
/** |
| 81 |
* Retrieves the details of an existing subscription schedule. You only need to |
| 82 |
* supply the unique subscription schedule identifier that was returned upon |
| 83 |
* subscription schedule creation. |
| 84 |
* |
| 85 |
* @param string $id |
| 86 |
* @param null|array $params |
| 87 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 88 |
* |
| 89 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 90 |
* |
| 91 |
* @return \Stripe\SubscriptionSchedule |
| 92 |
*/ |
| 93 |
public function retrieve($id, $params = null, $opts = null) |
| 94 |
{ |
| 95 |
return $this->request('get', $this->buildPath('/v1/subscription_schedules/%s', $id), $params, $opts); |
| 96 |
} |
| 97 |
|
| 98 |
/** |
| 99 |
* Updates an existing subscription schedule. |
| 100 |
* |
| 101 |
* @param string $id |
| 102 |
* @param null|array $params |
| 103 |
* @param null|array|\Stripe\Util\RequestOptions $opts |
| 104 |
* |
| 105 |
* @throws \Stripe\Exception\ApiErrorException if the request fails |
| 106 |
* |
| 107 |
* @return \Stripe\SubscriptionSchedule |
| 108 |
*/ |
| 109 |
public function update($id, $params = null, $opts = null) |
| 110 |
{ |
| 111 |
return $this->request('post', $this->buildPath('/v1/subscription_schedules/%s', $id), $params, $opts); |
| 112 |
} |
| 113 |
} |
| 114 |
|