SubscriptionScheduleService.php 3.9 KB

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