ApiOperations
1 year ago
Apps
1 year ago
Billing
1 year ago
BillingPortal
1 year ago
Checkout
1 year ago
Climate
1 year ago
Entitlements
1 year ago
EventData
1 year ago
Events
1 year ago
Exception
1 year ago
FinancialConnections
1 year ago
Forwarding
1 year ago
HttpClient
1 year ago
Identity
1 year ago
Issuing
1 year ago
Radar
1 year ago
Reporting
1 year ago
Service
1 year ago
Sigma
1 year ago
Tax
1 year ago
Terminal
1 year ago
TestHelpers
1 year ago
Treasury
1 year ago
Util
1 year ago
V2
1 year ago
Account.php
1 year ago
AccountLink.php
1 year ago
AccountSession.php
1 year ago
ApiRequestor.php
1 year ago
ApiResource.php
2 years ago
ApiResponse.php
2 years ago
ApplePayDomain.php
1 year ago
Application.php
2 years ago
ApplicationFee.php
1 year ago
ApplicationFeeRefund.php
2 years ago
Balance.php
1 year ago
BalanceTransaction.php
1 year ago
BankAccount.php
1 year ago
BaseStripeClient.php
1 year ago
BaseStripeClientInterface.php
1 year ago
Capability.php
1 year ago
Card.php
1 year ago
CashBalance.php
2 years ago
Charge.php
1 year ago
Collection.php
1 year ago
ConfirmationToken.php
1 year ago
ConnectCollectionTransfer.php
2 years ago
CountrySpec.php
1 year ago
Coupon.php
1 year ago
CreditNote.php
1 year ago
CreditNoteLineItem.php
1 year ago
Customer.php
1 year ago
CustomerBalanceTransaction.php
2 years ago
CustomerCashBalanceTransaction.php
2 years ago
CustomerSession.php
1 year ago
Discount.php
1 year ago
Dispute.php
1 year ago
EphemeralKey.php
1 year ago
ErrorObject.php
1 year ago
Event.php
1 year ago
ExchangeRate.php
1 year ago
File.php
1 year ago
FileLink.php
1 year ago
FundingInstructions.php
2 years ago
Invoice.php
1 year ago
InvoiceItem.php
1 year ago
InvoiceLineItem.php
1 year ago
InvoiceRenderingTemplate.php
1 year ago
LineItem.php
1 year ago
LoginLink.php
1 year ago
Mandate.php
1 year ago
OAuth.php
2 years ago
OAuthErrorObject.php
1 year ago
PaymentIntent.php
1 year ago
PaymentLink.php
1 year ago
PaymentMethod.php
1 year ago
PaymentMethodConfiguration.php
1 year ago
PaymentMethodDomain.php
1 year ago
Payout.php
1 year ago
Person.php
1 year ago
Plan.php
1 year ago
Price.php
1 year ago
Product.php
1 year ago
ProductFeature.php
1 year ago
PromotionCode.php
1 year ago
Quote.php
1 year ago
Reason.php
1 year ago
RecipientTransfer.php
2 years ago
Refund.php
1 year ago
RelatedObject.php
1 year ago
RequestTelemetry.php
2 years ago
ReserveTransaction.php
2 years ago
Review.php
1 year ago
SearchResult.php
1 year ago
SetupAttempt.php
1 year ago
SetupIntent.php
1 year ago
ShippingRate.php
1 year ago
SingletonApiResource.php
2 years ago
Source.php
1 year ago
SourceMandateNotification.php
2 years ago
SourceTransaction.php
2 years ago
Stripe.php
1 year ago
StripeClient.php
1 year ago
StripeClientInterface.php
2 years ago
StripeObject.php
1 year ago
StripeStreamingClientInterface.php
2 years ago
Subscription.php
1 year ago
SubscriptionItem.php
1 year ago
SubscriptionSchedule.php
1 year ago
TaxCode.php
1 year ago
TaxDeductedAtSource.php
2 years ago
TaxId.php
1 year ago
TaxRate.php
1 year ago
ThinEvent.php
1 year ago
Token.php
1 year ago
Topup.php
1 year ago
Transfer.php
1 year ago
TransferReversal.php
1 year ago
UsageRecord.php
1 year ago
UsageRecordSummary.php
1 year ago
Webhook.php
1 year ago
WebhookEndpoint.php
1 year ago
WebhookSignature.php
2 years ago
SubscriptionSchedule.php
148 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | namespace WPForms\Vendor\Stripe; |
| 5 | |
| 6 | /** |
| 7 | * A subscription schedule allows you to create and manage the lifecycle of a subscription by predefining expected changes. |
| 8 | * |
| 9 | * Related guide: <a href="https://stripe.com/docs/billing/subscriptions/subscription-schedules">Subscription schedules</a> |
| 10 | * |
| 11 | * @property string $id Unique identifier for the object. |
| 12 | * @property string $object String representing the object's type. Objects of the same type share the same value. |
| 13 | * @property null|string|\Stripe\Application $application ID of the Connect Application that created the schedule. |
| 14 | * @property null|int $canceled_at Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch. |
| 15 | * @property null|int $completed_at Time at which the subscription schedule was completed. Measured in seconds since the Unix epoch. |
| 16 | * @property int $created Time at which the object was created. Measured in seconds since the Unix epoch. |
| 17 | * @property null|\Stripe\StripeObject $current_phase Object representing the start and end dates for the current phase of the subscription schedule, if it is <code>active</code>. |
| 18 | * @property string|\Stripe\Customer $customer ID of the customer who owns the subscription schedule. |
| 19 | * @property \Stripe\StripeObject $default_settings |
| 20 | * @property string $end_behavior Behavior of the subscription schedule and underlying subscription when it ends. Possible values are <code>release</code> or <code>cancel</code> with the default being <code>release</code>. <code>release</code> will end the subscription schedule and keep the underlying subscription running. <code>cancel</code> will end the subscription schedule and cancel the underlying subscription. |
| 21 | * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. |
| 22 | * @property null|\Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. |
| 23 | * @property \Stripe\StripeObject[] $phases Configuration for the subscription schedule's phases. |
| 24 | * @property null|int $released_at Time at which the subscription schedule was released. Measured in seconds since the Unix epoch. |
| 25 | * @property null|string $released_subscription ID of the subscription once managed by the subscription schedule (if it is released). |
| 26 | * @property string $status The present status of the subscription schedule. Possible values are <code>not_started</code>, <code>active</code>, <code>completed</code>, <code>released</code>, and <code>canceled</code>. You can read more about the different states in our <a href="https://stripe.com/docs/billing/subscriptions/subscription-schedules">behavior guide</a>. |
| 27 | * @property null|string|\Stripe\Subscription $subscription ID of the subscription managed by the subscription schedule. |
| 28 | * @property null|string|\Stripe\TestHelpers\TestClock $test_clock ID of the test clock this subscription schedule belongs to. |
| 29 | */ |
| 30 | class SubscriptionSchedule extends ApiResource |
| 31 | { |
| 32 | const OBJECT_NAME = 'subscription_schedule'; |
| 33 | use ApiOperations\Update; |
| 34 | const END_BEHAVIOR_CANCEL = 'cancel'; |
| 35 | const END_BEHAVIOR_NONE = 'none'; |
| 36 | const END_BEHAVIOR_RELEASE = 'release'; |
| 37 | const END_BEHAVIOR_RENEW = 'renew'; |
| 38 | const STATUS_ACTIVE = 'active'; |
| 39 | const STATUS_CANCELED = 'canceled'; |
| 40 | const STATUS_COMPLETED = 'completed'; |
| 41 | const STATUS_NOT_STARTED = 'not_started'; |
| 42 | const STATUS_RELEASED = 'released'; |
| 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|string $options |
| 49 | * |
| 50 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 51 | * |
| 52 | * @return \Stripe\SubscriptionSchedule the created resource |
| 53 | */ |
| 54 | public static function create($params = null, $options = null) |
| 55 | { |
| 56 | self::_validateParams($params); |
| 57 | $url = static::classUrl(); |
| 58 | list($response, $opts) = static::_staticRequest('post', $url, $params, $options); |
| 59 | $obj = \WPForms\Vendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 60 | $obj->setLastResponse($response); |
| 61 | return $obj; |
| 62 | } |
| 63 | /** |
| 64 | * Retrieves the list of your subscription schedules. |
| 65 | * |
| 66 | * @param null|array $params |
| 67 | * @param null|array|string $opts |
| 68 | * |
| 69 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 70 | * |
| 71 | * @return \Stripe\Collection<\Stripe\SubscriptionSchedule> of ApiResources |
| 72 | */ |
| 73 | public static function all($params = null, $opts = null) |
| 74 | { |
| 75 | $url = static::classUrl(); |
| 76 | return static::_requestPage($url, \WPForms\Vendor\Stripe\Collection::class, $params, $opts); |
| 77 | } |
| 78 | /** |
| 79 | * Retrieves the details of an existing subscription schedule. You only need to |
| 80 | * supply the unique subscription schedule identifier that was returned upon |
| 81 | * subscription schedule creation. |
| 82 | * |
| 83 | * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key |
| 84 | * @param null|array|string $opts |
| 85 | * |
| 86 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 87 | * |
| 88 | * @return \Stripe\SubscriptionSchedule |
| 89 | */ |
| 90 | public static function retrieve($id, $opts = null) |
| 91 | { |
| 92 | $opts = \WPForms\Vendor\Stripe\Util\RequestOptions::parse($opts); |
| 93 | $instance = new static($id, $opts); |
| 94 | $instance->refresh(); |
| 95 | return $instance; |
| 96 | } |
| 97 | /** |
| 98 | * Updates an existing subscription schedule. |
| 99 | * |
| 100 | * @param string $id the ID of the resource to update |
| 101 | * @param null|array $params |
| 102 | * @param null|array|string $opts |
| 103 | * |
| 104 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 105 | * |
| 106 | * @return \Stripe\SubscriptionSchedule the updated resource |
| 107 | */ |
| 108 | public static function update($id, $params = null, $opts = null) |
| 109 | { |
| 110 | self::_validateParams($params); |
| 111 | $url = static::resourceUrl($id); |
| 112 | list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); |
| 113 | $obj = \WPForms\Vendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 114 | $obj->setLastResponse($response); |
| 115 | return $obj; |
| 116 | } |
| 117 | /** |
| 118 | * @param null|array $params |
| 119 | * @param null|array|string $opts |
| 120 | * |
| 121 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 122 | * |
| 123 | * @return \Stripe\SubscriptionSchedule the canceled subscription schedule |
| 124 | */ |
| 125 | public function cancel($params = null, $opts = null) |
| 126 | { |
| 127 | $url = $this->instanceUrl() . '/cancel'; |
| 128 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 129 | $this->refreshFrom($response, $opts); |
| 130 | return $this; |
| 131 | } |
| 132 | /** |
| 133 | * @param null|array $params |
| 134 | * @param null|array|string $opts |
| 135 | * |
| 136 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 137 | * |
| 138 | * @return \Stripe\SubscriptionSchedule the released subscription schedule |
| 139 | */ |
| 140 | public function release($params = null, $opts = null) |
| 141 | { |
| 142 | $url = $this->instanceUrl() . '/release'; |
| 143 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 144 | $this->refreshFrom($response, $opts); |
| 145 | return $this; |
| 146 | } |
| 147 | } |
| 148 |