Class: Stripe::SubscriptionSchedule
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::SubscriptionSchedule
- Extended by:
- APIOperations::Create, APIOperations::List
- Includes:
- APIOperations::Save
- Defined in:
- lib/stripe/resources/subscription_schedule.rb
Overview
A subscription schedule allows you to create and manage the lifecycle of a subscription by predefining expected changes.
Related guide: [Subscription schedules](stripe.com/docs/billing/subscriptions/subscription-schedules)
Defined Under Namespace
Classes: AmendParams, CancelParams, CreateParams, CurrentPhase, DefaultSettings, LastPriceMigrationError, ListParams, Phase, Prebilling, ReleaseParams, UpdateParams
Constant Summary collapse
- OBJECT_NAME =
"subscription_schedule"
Constants inherited from StripeObject
Stripe::StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#application ⇒ Object
readonly
ID of the Connect Application that created the schedule.
-
#billing_behavior ⇒ Object
readonly
Configures when the subscription schedule generates prorations for phase transitions.
-
#billing_mode ⇒ Object
readonly
The [billing mode](/api/subscriptions/create#create_subscription-billing_mode) that will be used to process all future operations for the subscription schedule.
-
#canceled_at ⇒ Object
readonly
Time at which the subscription schedule was canceled.
-
#completed_at ⇒ Object
readonly
Time at which the subscription schedule was completed.
-
#created ⇒ Object
readonly
Time at which the object was created.
-
#current_phase ⇒ Object
readonly
Object representing the start and end dates for the current phase of the subscription schedule, if it is ‘active`.
-
#customer ⇒ Object
readonly
ID of the customer who owns the subscription schedule.
-
#customer_account ⇒ Object
readonly
ID of the account who owns the subscription schedule.
-
#default_settings ⇒ Object
readonly
Attribute for field default_settings.
-
#end_behavior ⇒ Object
readonly
Behavior of the subscription schedule and underlying subscription when it ends.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#last_price_migration_error ⇒ Object
readonly
Details of the most recent price migration that failed for the subscription schedule.
-
#livemode ⇒ Object
readonly
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
-
#metadata ⇒ Object
readonly
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#phases ⇒ Object
readonly
Configuration for the subscription schedule’s phases.
-
#prebilling ⇒ Object
readonly
Time period and invoice for a Subscription billed in advance.
-
#released_at ⇒ Object
readonly
Time at which the subscription schedule was released.
-
#released_subscription ⇒ Object
readonly
ID of the subscription once managed by the subscription schedule (if it is released).
-
#status ⇒ Object
readonly
The present status of the subscription schedule.
-
#subscription ⇒ Object
readonly
ID of the subscription managed by the subscription schedule.
-
#test_clock ⇒ Object
readonly
ID of the test clock this subscription schedule belongs to.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.amend(schedule, params = {}, opts = {}) ⇒ Object
Amends an existing subscription schedule.
-
.cancel(schedule, params = {}, opts = {}) ⇒ Object
Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription).
-
.create(params = {}, opts = {}) ⇒ Object
Creates a new subscription schedule object.
-
.list(params = {}, opts = {}) ⇒ Object
Retrieves the list of your subscription schedules.
- .object_name ⇒ Object
-
.release(schedule, params = {}, opts = {}) ⇒ Object
Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place.
-
.update(schedule, params = {}, opts = {}) ⇒ Object
Updates an existing subscription schedule.
Instance Method Summary collapse
-
#amend(params = {}, opts = {}) ⇒ Object
Amends an existing subscription schedule.
-
#cancel(params = {}, opts = {}) ⇒ Object
Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription).
-
#release(params = {}, opts = {}) ⇒ Object
Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place.
Methods included from APIOperations::Create
Methods included from APIOperations::List
Methods included from APIOperations::Save
Methods inherited from APIResource
class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource
Methods included from APIOperations::Request
Methods inherited from StripeObject
#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values
Constructor Details
This class inherits a constructor from Stripe::StripeObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject
Instance Attribute Details
#application ⇒ Object (readonly)
ID of the Connect Application that created the schedule.
2351 2352 2353 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2351 def application @application end |
#billing_behavior ⇒ Object (readonly)
Configures when the subscription schedule generates prorations for phase transitions. Possible values are ‘prorate_on_next_phase` or `prorate_up_front` with the default being `prorate_on_next_phase`. `prorate_on_next_phase` will apply phase changes and generate prorations at transition time. `prorate_up_front` will bill for all phases within the current billing cycle up front.
2353 2354 2355 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2353 def billing_behavior @billing_behavior end |
#billing_mode ⇒ Object (readonly)
The [billing mode](/api/subscriptions/create#create_subscription-billing_mode) that will be used to process all future operations for the subscription schedule.
2355 2356 2357 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2355 def billing_mode @billing_mode end |
#canceled_at ⇒ Object (readonly)
Time at which the subscription schedule was canceled. Measured in seconds since the Unix epoch.
2357 2358 2359 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2357 def canceled_at @canceled_at end |
#completed_at ⇒ Object (readonly)
Time at which the subscription schedule was completed. Measured in seconds since the Unix epoch.
2359 2360 2361 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2359 def completed_at @completed_at end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
2361 2362 2363 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2361 def created @created end |
#current_phase ⇒ Object (readonly)
Object representing the start and end dates for the current phase of the subscription schedule, if it is ‘active`.
2363 2364 2365 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2363 def current_phase @current_phase end |
#customer ⇒ Object (readonly)
ID of the customer who owns the subscription schedule.
2365 2366 2367 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2365 def customer @customer end |
#customer_account ⇒ Object (readonly)
ID of the account who owns the subscription schedule.
2367 2368 2369 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2367 def customer_account @customer_account end |
#default_settings ⇒ Object (readonly)
Attribute for field default_settings
2369 2370 2371 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2369 def default_settings @default_settings end |
#end_behavior ⇒ Object (readonly)
Behavior of the subscription schedule and underlying subscription 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.
2371 2372 2373 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2371 def end_behavior @end_behavior end |
#id ⇒ Object (readonly)
Unique identifier for the object.
2373 2374 2375 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2373 def id @id end |
#last_price_migration_error ⇒ Object (readonly)
Details of the most recent price migration that failed for the subscription schedule.
2375 2376 2377 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2375 def last_price_migration_error @last_price_migration_error end |
#livemode ⇒ Object (readonly)
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
2377 2378 2379 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2377 def livemode @livemode end |
#metadata ⇒ Object (readonly)
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
2379 2380 2381 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2379 def @metadata end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
2381 2382 2383 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2381 def object @object end |
#phases ⇒ Object (readonly)
Configuration for the subscription schedule’s phases.
2383 2384 2385 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2383 def phases @phases end |
#prebilling ⇒ Object (readonly)
Time period and invoice for a Subscription billed in advance.
2385 2386 2387 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2385 def prebilling @prebilling end |
#released_at ⇒ Object (readonly)
Time at which the subscription schedule was released. Measured in seconds since the Unix epoch.
2387 2388 2389 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2387 def released_at @released_at end |
#released_subscription ⇒ Object (readonly)
ID of the subscription once managed by the subscription schedule (if it is released).
2389 2390 2391 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2389 def released_subscription @released_subscription end |
#status ⇒ Object (readonly)
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 our [behavior guide](stripe.com/docs/billing/subscriptions/subscription-schedules).
2391 2392 2393 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2391 def status @status end |
#subscription ⇒ Object (readonly)
ID of the subscription managed by the subscription schedule.
2393 2394 2395 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2393 def subscription @subscription end |
#test_clock ⇒ Object (readonly)
ID of the test clock this subscription schedule belongs to.
2395 2396 2397 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2395 def test_clock @test_clock end |
Class Method Details
.amend(schedule, params = {}, opts = {}) ⇒ Object
Amends an existing subscription schedule.
2408 2409 2410 2411 2412 2413 2414 2415 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2408 def self.amend(schedule, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/subscription_schedules/%<schedule>s/amend", { schedule: CGI.escape(schedule) }), params: params, opts: opts ) end |
.cancel(schedule, params = {}, opts = {}) ⇒ Object
Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
2428 2429 2430 2431 2432 2433 2434 2435 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2428 def self.cancel(schedule, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/subscription_schedules/%<schedule>s/cancel", { schedule: CGI.escape(schedule) }), params: params, opts: opts ) end |
.create(params = {}, opts = {}) ⇒ Object
Creates a new subscription schedule object. Each customer can have up to 500 active or scheduled subscriptions.
2438 2439 2440 2441 2442 2443 2444 2445 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2438 def self.create(params = {}, opts = {}) request_stripe_object( method: :post, path: "/v1/subscription_schedules", params: params, opts: opts ) end |
.list(params = {}, opts = {}) ⇒ Object
Retrieves the list of your subscription schedules.
2448 2449 2450 2451 2452 2453 2454 2455 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2448 def self.list(params = {}, opts = {}) request_stripe_object( method: :get, path: "/v1/subscription_schedules", params: params, opts: opts ) end |
.object_name ⇒ Object
14 15 16 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 14 def self.object_name "subscription_schedule" end |
.release(schedule, params = {}, opts = {}) ⇒ Object
Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription’s ID to the released_subscription property.
2468 2469 2470 2471 2472 2473 2474 2475 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2468 def self.release(schedule, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/subscription_schedules/%<schedule>s/release", { schedule: CGI.escape(schedule) }), params: params, opts: opts ) end |
.update(schedule, params = {}, opts = {}) ⇒ Object
Updates an existing subscription schedule.
2478 2479 2480 2481 2482 2483 2484 2485 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2478 def self.update(schedule, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/subscription_schedules/%<schedule>s", { schedule: CGI.escape(schedule) }), params: params, opts: opts ) end |
Instance Method Details
#amend(params = {}, opts = {}) ⇒ Object
Amends an existing subscription schedule.
2398 2399 2400 2401 2402 2403 2404 2405 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2398 def amend(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/subscription_schedules/%<schedule>s/amend", { schedule: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#cancel(params = {}, opts = {}) ⇒ Object
Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active.
2418 2419 2420 2421 2422 2423 2424 2425 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2418 def cancel(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/subscription_schedules/%<schedule>s/cancel", { schedule: CGI.escape(self["id"]) }), params: params, opts: opts ) end |
#release(params = {}, opts = {}) ⇒ Object
Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription’s ID to the released_subscription property.
2458 2459 2460 2461 2462 2463 2464 2465 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 2458 def release(params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/subscription_schedules/%<schedule>s/release", { schedule: CGI.escape(self["id"]) }), params: params, opts: opts ) end |