NAME
Net::API::Stripe::Billing::Subscription::Schedule - A Stripe Subscription Schedule Object
SYNOPSIS
my $sched = $stripe->schedule({
customer => $customer_object,
invoice_now => 1,
end_behavior => 'release',
});
VERSION
v0.100.0
DESCRIPTION
A subscription schedule allows you to create and manage the lifecycle of a subscription by predefining expected changes.
CONSTRUCTOR
- new( %ARG )
-
Creates a new Net::API::Stripe::Billing::Subscription::Schedule object. It may also take an hash like arguments, that also are method of the same name.
METHODS
- id string
-
Unique identifier for the object.
- object string, value is
subscription_schedule
-
String representing the object’s type. Objects of the same type share the same value.
- canceled_at timestamp
-
Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch.
- completed_at timestamp
-
Time at which the subscription schedule was completed. Measured in seconds since the Unix epoch.
- created timestamp
-
Time at which the object was created. Measured in seconds since the Unix epoch.
- current_phase hash
-
Object representing the start and end dates for the current phase of the subscription schedule, if it is active.
- customer string expandable
-
ID of the customer who owns the subscription schedule. When expanded, this is a Net::API::Stripe::Customer object.
- default_settings hash
-
Object representing the subscription schedule’s default settings.
- billing_thresholds hash
-
Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period
This is a Net::API::Stripe::Billing::Thresholds object.
- amount_gte integer
-
Monetary threshold that triggers the subscription to create an invoice
- reset_billing_cycle_anchor boolean
-
Indicates if the billing_cycle_anchor should be reset when a threshold is reached. If true, billing_cycle_anchor will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. This value may not be true if the subscription contains items with plans that have aggregate_usage=last_ever.
- collection_method string
-
Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions.
- default_payment_method string expandable
-
ID of the default payment method for the subscription schedule. If not set, invoices will use the default payment method in the customer’s invoice settings. When expanded, this is a Net::API::Stripe::Payment::Method object.
- invoice_settings hash
-
The subscription schedule’s default invoice settings.
- end_behavior string
-
Configures how the subscription schedule behaves when it ends. Possible values are release or cancel with the default being release. release will end the subscription schedule and keep the underlying subscription running.cancel will end the subscription schedule and cancel the underlying subscription.
- from_subscription string
-
Migrate an existing subscription to be managed by a subscription schedule. If this parameter is set, a subscription schedule will be created using the subscription’s plan(s), set to auto-renew using the subscription’s interval. When using this parameter, other parameters (such as phase values) cannot be set. To create a subscription schedule with other modifications, Stripe recommends making two separate API calls.
This is used only when creating a subscription schedule.
- invoice_now boolean
-
If the subscription schedule is active, indicates whether or not to generate a final invoice that contains any un-invoiced metered usage and new/pending proration invoice items. Defaults to true.
This is used only when cancelling a subscription schedule.
- livemode boolean
-
Has the value true if the object exists in live mode or the value false if the object exists in test mode.
- metadata hash
-
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
- phases array of hashes
-
Configuration for the subscription schedule’s phases.
- application_fee_percent decimal
-
A non-negative decimal between 0 and 100, with at most two decimal places. This represents the percentage of the subscription invoice subtotal that will be transferred to the application owner’s Stripe account during this phase of the schedule.
- billing_thresholds hash
-
Define thresholds at which an invoice will be sent, and the subscription advanced to a new billing period.
This is a Net::API::Stripe::Billing::Thresholds object.
- amount_gte integer
-
Monetary threshold that triggers the subscription to create an invoice
- reset_billing_cycle_anchor boolean
-
Indicates if the billing_cycle_anchor should be reset when a threshold is reached. If true, billing_cycle_anchor will be updated to the date/time the threshold was last reached; otherwise, the value will remain unchanged. This value may not be true if the subscription contains items with plans that have aggregate_usage=last_ever.
- collection_method string
-
Either charge_automatically, or send_invoice. When charging automatically, Stripe will attempt to pay the underlying subscription at the end of each billing cycle using the default source attached to the customer. When sending an invoice, Stripe will email your customer an invoice with payment instructions.
- coupon string expandable
-
ID of the coupon to use during this phase of the subscription schedule. When expanded, this is a Net::API::Stripe::Billing::Coupon object.
- default_payment_method string expandable
-
ID of the default payment method for the subscription schedule. It must belong to the customer associated with the subscription schedule. If not set, invoices will use the default payment method in the customer’s invoice settings.
When expanded, this is a Net::API::Stripe::Payment::Method object.
- default_tax_rates array of Net::API::Stripe::Tax::Rate objects.
- end_date timestamp
-
The end of this phase of the subscription schedule.
- invoice_settings hash
-
The subscription schedule’s default invoice settings.
- iterations integer
-
Integer representing the multiplier applied to the plan interval. For example, iterations=2 applied to a plan with interval=month and interval_count=3 results in a phase of duration 2 * 3 months = 6 months. If set, end_date must not be set.
This option is only used in making calls to create or update a subscription schedule.
- plans array of hashes
-
Plans to subscribe during this phase of the subscription schedule.
- billing_thresholds hash
-
Define thresholds at which an invoice will be sent, and the related subscription advanced to a new billing period
- plan string expandable
-
ID of the plan to which the customer should be subscribed. When expanded, this is a Net::API::Stripe::Billing::Plan object.
- quantity positive integer or zero
-
Quantity of the plan to which the customer should be subscribed.
- tax_rates array of Net::APi::Stripe::Tax::Rate objects.
-
The tax rates which apply to this phase_item. When set, the default_tax_rates on the phase do not apply to this phase_item.
- start_date timestamp
-
The start of this phase of the subscription schedule.
- trial_end timestamp
-
When the trial ends within the phase.
- preserve_cancel_date boolean
-
Keep any cancellation on the subscription that the schedule has set.
This is used only when cancelling subscription schedule.
- preserve_cancel_date boolean
-
Keep any cancellation on the subscription that the schedule has set.
This is used only when making a Stripe api call to release a subscription schedule.
- prorate boolean
-
This is only used when making update or cancel.
When doing an update and if the update changes the current phase, indicates if the changes should be prorated. Defaults to true.
When cancelling the subscription schedule, if the subscription schedule is active, this indicates if the cancellation should be prorated. Defaults to true.
- released_at timestamp
-
Time at which the subscription schedule was released. Measured in seconds since the Unix epoch.
- released_subscription string
-
ID of the subscription once managed by the subscription schedule (if it is released).
- start_date unix timestamp
-
When the subscription schedule starts. Stripe recommends using now so that it starts the subscription immediately. You can also use a Unix timestamp to backdate the subscription so that it starts on a past date, or set a future date for the subscription to start on. When you backdate, the billing_cycle_anchor of the subscription is equivalent to the start_date.
This is used only when creating a subscription schedule.
- status string
-
The present status of the subscription schedule. Possible values are not_started, active, completed, released, and canceled. You can read more about the different states in Stripe behavior guide.
- subscription string expandable
-
ID of the subscription managed by the subscription schedule. When expanded, this is a Net::API::Stripe::Billing::Subscription object.
API SAMPLE
{
"id": "sub_sched_fake123456789",
"object": "subscription_schedule",
"canceled_at": null,
"completed_at": null,
"created": 1577193148,
"current_phase": null,
"customer": "cus_fake123456789",
"default_settings": {
"billing_thresholds": null,
"collection_method": "charge_automatically",
"default_payment_method": null,
"invoice_settings": null
},
"end_behavior": "cancel",
"livemode": false,
"metadata": {},
"phases": [
{
"application_fee_percent": null,
"billing_thresholds": null,
"collection_method": null,
"coupon": null,
"default_payment_method": null,
"default_tax_rates": [],
"end_date": 1572481590,
"invoice_settings": null,
"plans": [
{
"billing_thresholds": null,
"plan": "gold",
"quantity": 1,
"tax_rates": []
}
],
"start_date": 1541031990,
"tax_percent": null,
"trial_end": null
}
],
"released_at": null,
"released_subscription": null,
"status": "not_started",
"subscription": null
}
HISTORY
v0.1
Initial version
AUTHOR
Jacques Deguest <jack@deguest.jp>
SEE ALSO
Stripe API documentation:
https://stripe.com/docs/api, https://stripe.com/docs/api/subscription_schedules/object, https://stripe.com/docs/billing/subscriptions/subscription-schedules#managing
COPYRIGHT & LICENSE
Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
You can use, copy, modify and redistribute this package and associated files under the same terms as Perl itself.