The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

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.101.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.

application expandable

ID of the Connect Application that created the schedule.

When expanded this is an Net::API::Stripe::Connect::Account object.

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.

end_date timestamp
start_date timestamp

customer string expandable

ID of the customer who owns the subscription schedule. When expanded, this is a Net::API::Stripe::Customer object.

default_settings object

Object representing the subscription schedule's default settings.

This is a Net::API::Stripe::Billing::Subscription object.

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 objects

Configuration for the subscription schedule's phases.

This is a Net::API::Stripe::Billing::Subscription object.

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.

proration_behavior string

Determines how to handle prorations resulting from the billing_cycle_anchor. Valid values are create_prorations or none.

Passing create_prorations will cause proration invoice items to be created when applicable. Prorations can be disabled by passing none. If no value is passed, the default is create_prorations.

This property is not documented on Stripe api documentation, but appears in data returned as of 2020-12-02.

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).

renewal_interval

This property was found in the data returned from Stripe, but is not documented yet as of 2020-12-03.

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.

tax_percent decimal (deprecated)

A non-negative decimal (with at most four decimal places) between 0 and 100. This represents the percentage of the subscription invoice subtotal that will be calculated and added as tax to the final amount in each billing period. For example, a plan which charges $10/month with a tax_percent of 20.0 will charge $12 per invoice. To unset a previously-set value, pass an empty string. This field has been deprecated and will be removed in a future API version, for further information view the migration docs for tax_rates.

This is an undocumented property for Subscription Schedule that usually belonging to Subscription, but that appears in data returned by Stripe.

test_clock expandable

ID of the test clock this subscription schedule belongs to.

When expanded this is an Net::API::Stripe::Billing::TestHelpersTestClock object.

transfer_data hash

This is for Connect only.

The account (if any) the subscription’s payments will be attributed to for tax reporting, and where funds from each payment will be transferred to for each of the subscription’s invoices.

This is an undocumented property for Subscription Schedule that usually belonging to Subscription, but that appears in data returned by Stripe.

amount_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 destination account. By default, the entire amount is transferred to the destination.

destination string expandable

The account where funds from the payment will be transferred to upon payment success.

trial_end timestamp

If the subscription has a trial, the end of that trial.

This is an undocumented property for Subscription Schedule that usually belonging to Subscription, but that appears in data returned by Stripe.

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

See also use cases

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.