Class: Stripe::InvoiceService::CreatePreviewParams::SubscriptionDetails
- Inherits:
-
RequestParams
- Object
- RequestParams
- Stripe::InvoiceService::CreatePreviewParams::SubscriptionDetails
- Defined in:
- lib/stripe/services/invoice_service.rb
Defined Under Namespace
Classes: BillingMode, Item, Prebilling
Instance Attribute Summary collapse
-
#billing_cycle_anchor ⇒ Object
For new subscriptions, a future timestamp to anchor the subscription’s [billing cycle](stripe.com/docs/subscriptions/billing-cycle).
-
#billing_mode ⇒ Object
Controls how prorations and invoices for subscriptions are calculated and orchestrated.
-
#cancel_at ⇒ Object
A timestamp at which the subscription should cancel.
-
#cancel_at_period_end ⇒ Object
Indicate whether this subscription should cancel at the end of the current period (‘current_period_end`).
-
#cancel_now ⇒ Object
This simulates the subscription being canceled or expired immediately.
-
#default_tax_rates ⇒ Object
If provided, the invoice returned will preview updating or creating a subscription with these default tax rates.
-
#items ⇒ Object
A list of up to 20 subscription items, each with an attached price.
-
#prebilling ⇒ Object
The pre-billing to apply to the subscription as a preview.
-
#proration_behavior ⇒ Object
Determines how to handle [prorations](stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting ‘billing_cycle_anchor=now`, or starting a trial), or if an item’s ‘quantity` changes.
-
#proration_date ⇒ Object
If previewing an update to a subscription, and doing proration, ‘subscription_details.proration_date` forces the proration to be calculated as though the update was done at the specified time.
-
#resume_at ⇒ Object
For paused subscriptions, setting ‘subscription_details.resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed.
-
#start_date ⇒ Object
Date a subscription is intended to start (can be future or past).
-
#trial_end ⇒ Object
If provided, the invoice returned will preview updating or creating a subscription with that trial end.
Instance Method Summary collapse
-
#initialize(billing_cycle_anchor: nil, billing_mode: nil, cancel_at: nil, cancel_at_period_end: nil, cancel_now: nil, default_tax_rates: nil, items: nil, prebilling: nil, proration_behavior: nil, proration_date: nil, resume_at: nil, start_date: nil, trial_end: nil) ⇒ SubscriptionDetails
constructor
A new instance of SubscriptionDetails.
Methods inherited from RequestParams
Constructor Details
#initialize(billing_cycle_anchor: nil, billing_mode: nil, cancel_at: nil, cancel_at_period_end: nil, cancel_now: nil, default_tax_rates: nil, items: nil, prebilling: nil, proration_behavior: nil, proration_date: nil, resume_at: nil, start_date: nil, trial_end: nil) ⇒ SubscriptionDetails
Returns a new instance of SubscriptionDetails.
3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 |
# File 'lib/stripe/services/invoice_service.rb', line 3753 def initialize( billing_cycle_anchor: nil, billing_mode: nil, cancel_at: nil, cancel_at_period_end: nil, cancel_now: nil, default_tax_rates: nil, items: nil, prebilling: nil, proration_behavior: nil, proration_date: nil, resume_at: nil, start_date: nil, trial_end: nil ) @billing_cycle_anchor = billing_cycle_anchor @billing_mode = billing_mode @cancel_at = cancel_at @cancel_at_period_end = cancel_at_period_end @cancel_now = cancel_now @default_tax_rates = default_tax_rates @items = items @prebilling = prebilling @proration_behavior = proration_behavior @proration_date = proration_date @resume_at = resume_at @start_date = start_date @trial_end = trial_end end |
Instance Attribute Details
#billing_cycle_anchor ⇒ Object
For new subscriptions, a future timestamp to anchor the subscription’s [billing cycle](stripe.com/docs/subscriptions/billing-cycle). This is used to determine the date of the first full invoice, and, for plans with ‘month` or `year` intervals, the day of the month for subsequent invoices. For existing subscriptions, the value can only be set to `now` or `unchanged`.
3727 3728 3729 |
# File 'lib/stripe/services/invoice_service.rb', line 3727 def billing_cycle_anchor @billing_cycle_anchor end |
#billing_mode ⇒ Object
Controls how prorations and invoices for subscriptions are calculated and orchestrated.
3729 3730 3731 |
# File 'lib/stripe/services/invoice_service.rb', line 3729 def billing_mode @billing_mode end |
#cancel_at ⇒ Object
A timestamp at which the subscription should cancel. If set to a date before the current period ends, this will cause a proration if prorations have been enabled using ‘proration_behavior`. If set during a future period, this will always cause a proration for that period.
3731 3732 3733 |
# File 'lib/stripe/services/invoice_service.rb', line 3731 def cancel_at @cancel_at end |
#cancel_at_period_end ⇒ Object
Indicate whether this subscription should cancel at the end of the current period (‘current_period_end`). Defaults to `false`.
3733 3734 3735 |
# File 'lib/stripe/services/invoice_service.rb', line 3733 def cancel_at_period_end @cancel_at_period_end end |
#cancel_now ⇒ Object
This simulates the subscription being canceled or expired immediately.
3735 3736 3737 |
# File 'lib/stripe/services/invoice_service.rb', line 3735 def cancel_now @cancel_now end |
#default_tax_rates ⇒ Object
If provided, the invoice returned will preview updating or creating a subscription with these default tax rates. The default tax rates will apply to any line item that does not have ‘tax_rates` set.
3737 3738 3739 |
# File 'lib/stripe/services/invoice_service.rb', line 3737 def default_tax_rates @default_tax_rates end |
#items ⇒ Object
A list of up to 20 subscription items, each with an attached price.
3739 3740 3741 |
# File 'lib/stripe/services/invoice_service.rb', line 3739 def items @items end |
#prebilling ⇒ Object
The pre-billing to apply to the subscription as a preview.
3741 3742 3743 |
# File 'lib/stripe/services/invoice_service.rb', line 3741 def prebilling @prebilling end |
#proration_behavior ⇒ Object
Determines how to handle [prorations](stripe.com/docs/billing/subscriptions/prorations) when the billing cycle changes (e.g., when switching plans, resetting ‘billing_cycle_anchor=now`, or starting a trial), or if an item’s ‘quantity` changes. The default value is `create_prorations`.
3743 3744 3745 |
# File 'lib/stripe/services/invoice_service.rb', line 3743 def proration_behavior @proration_behavior end |
#proration_date ⇒ Object
If previewing an update to a subscription, and doing proration, ‘subscription_details.proration_date` forces the proration to be calculated as though the update was done at the specified time. The time given must be within the current subscription period and within the current phase of the schedule backing this subscription, if the schedule exists. If set, `subscription`, and one of `subscription_details.items`, or `subscription_details.trial_end` are required. Also, `subscription_details.proration_behavior` cannot be set to ’none’.
3745 3746 3747 |
# File 'lib/stripe/services/invoice_service.rb', line 3745 def proration_date @proration_date end |
#resume_at ⇒ Object
For paused subscriptions, setting ‘subscription_details.resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed.
3747 3748 3749 |
# File 'lib/stripe/services/invoice_service.rb', line 3747 def resume_at @resume_at end |
#start_date ⇒ Object
Date a subscription is intended to start (can be future or past).
3749 3750 3751 |
# File 'lib/stripe/services/invoice_service.rb', line 3749 def start_date @start_date end |
#trial_end ⇒ Object
If provided, the invoice returned will preview updating or creating a subscription with that trial end. If set, one of ‘subscription_details.items` or `subscription` is required.
3751 3752 3753 |
# File 'lib/stripe/services/invoice_service.rb', line 3751 def trial_end @trial_end end |