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: BillingMode, CancelParams, CreateParams, CurrentPhase, DefaultSettings, ListParams, Phase, 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_mode ⇒ Object
readonly
The billing mode of the subscription.
-
#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.
-
#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.
-
#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.
-
#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
-
.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
-
#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.
1430 1431 1432 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1430 def application @application end |
#billing_mode ⇒ Object (readonly)
The billing mode of the subscription.
1432 1433 1434 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1432 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.
1434 1435 1436 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1434 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.
1436 1437 1438 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1436 def completed_at @completed_at end |
#created ⇒ Object (readonly)
Time at which the object was created. Measured in seconds since the Unix epoch.
1438 1439 1440 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1438 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`.
1440 1441 1442 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1440 def current_phase @current_phase end |
#customer ⇒ Object (readonly)
ID of the customer who owns the subscription schedule.
1442 1443 1444 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1442 def customer @customer end |
#default_settings ⇒ Object (readonly)
Attribute for field default_settings
1444 1445 1446 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1444 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.
1446 1447 1448 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1446 def end_behavior @end_behavior end |
#id ⇒ Object (readonly)
Unique identifier for the object.
1448 1449 1450 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1448 def id @id 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.
1450 1451 1452 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1450 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.
1452 1453 1454 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1452 def @metadata end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
1454 1455 1456 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1454 def object @object end |
#phases ⇒ Object (readonly)
Configuration for the subscription schedule’s phases.
1456 1457 1458 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1456 def phases @phases end |
#released_at ⇒ Object (readonly)
Time at which the subscription schedule was released. Measured in seconds since the Unix epoch.
1458 1459 1460 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1458 def released_at @released_at end |
#released_subscription ⇒ Object (readonly)
ID of the subscription once managed by the subscription schedule (if it is released).
1460 1461 1462 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1460 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).
1462 1463 1464 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1462 def status @status end |
#subscription ⇒ Object (readonly)
ID of the subscription managed by the subscription schedule.
1464 1465 1466 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1464 def subscription @subscription end |
#test_clock ⇒ Object (readonly)
ID of the test clock this subscription schedule belongs to.
1466 1467 1468 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1466 def test_clock @test_clock end |
Class Method Details
.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.
1479 1480 1481 1482 1483 1484 1485 1486 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1479 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.
1489 1490 1491 1492 1493 1494 1495 1496 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1489 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.
1499 1500 1501 1502 1503 1504 1505 1506 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1499 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.
1519 1520 1521 1522 1523 1524 1525 1526 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1519 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.
1529 1530 1531 1532 1533 1534 1535 1536 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1529 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
#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.
1469 1470 1471 1472 1473 1474 1475 1476 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1469 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.
1509 1510 1511 1512 1513 1514 1515 1516 |
# File 'lib/stripe/resources/subscription_schedule.rb', line 1509 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 |