Class: Stripe::InvoiceCreatePreviewParams::SubscriptionDetails
- Inherits:
-
RequestParams
- Object
- RequestParams
- Stripe::InvoiceCreatePreviewParams::SubscriptionDetails
- Defined in:
- lib/stripe/params/invoice_create_preview_params.rb
Defined Under Namespace
Classes: BillingMode, BillingSchedule, Item, Pause, Prebilling
Instance Attribute Summary collapse
-
#billing_cycle_anchor ⇒ Object
For new subscriptions, a future timestamp to anchor the subscription's billing cycle.
-
#billing_mode ⇒ Object
Controls how prorations and invoices for subscriptions are calculated and orchestrated.
-
#billing_schedules ⇒ Object
Sets the billing schedules for the subscription.
-
#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.
-
#metadata ⇒ Object
Set of key-value pairs that you can attach to an object.
-
#pause ⇒ Object
Previews the invoice that would be generated when pausing the subscription.
-
#prebilling ⇒ Object
The pre-billing to apply to the subscription as a preview.
-
#proration_behavior ⇒ Object
Determines how to handle prorations when the billing cycle changes (e.g., when switching plans, resetting
billing_cycle_anchor=now, or starting a trial), or if an item'squantitychanges. -
#proration_date ⇒ Object
If previewing an update to a subscription, and doing proration,
subscription_details.proration_dateforces 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_attonowwill 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.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(billing_cycle_anchor: nil, billing_mode: nil, billing_schedules: nil, cancel_at: nil, cancel_at_period_end: nil, cancel_now: nil, default_tax_rates: nil, items: nil, metadata: nil, pause: 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
attr_accessor, coerce_params, coerce_value, new, #to_h
Constructor Details
#initialize(billing_cycle_anchor: nil, billing_mode: nil, billing_schedules: nil, cancel_at: nil, cancel_at_period_end: nil, cancel_now: nil, default_tax_rates: nil, items: nil, metadata: nil, pause: 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.
2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2412 def initialize( billing_cycle_anchor: nil, billing_mode: nil, billing_schedules: nil, cancel_at: nil, cancel_at_period_end: nil, cancel_now: nil, default_tax_rates: nil, items: nil, metadata: nil, pause: 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 @billing_schedules = billing_schedules @cancel_at = cancel_at @cancel_at_period_end = cancel_at_period_end @cancel_now = cancel_now @default_tax_rates = default_tax_rates @items = items @metadata = @pause = pause @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. 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.
2376 2377 2378 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2376 def billing_cycle_anchor @billing_cycle_anchor end |
#billing_mode ⇒ Object
Controls how prorations and invoices for subscriptions are calculated and orchestrated.
2378 2379 2380 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2378 def billing_mode @billing_mode end |
#billing_schedules ⇒ Object
Sets the billing schedules for the subscription.
2380 2381 2382 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2380 def billing_schedules @billing_schedules 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.
2382 2383 2384 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2382 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.
2384 2385 2386 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2384 def cancel_at_period_end @cancel_at_period_end end |
#cancel_now ⇒ Object
This simulates the subscription being canceled or expired immediately.
2386 2387 2388 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2386 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.
2388 2389 2390 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2388 def default_tax_rates @default_tax_rates end |
#items ⇒ Object
A list of up to 20 subscription items, each with an attached price.
2390 2391 2392 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2390 def items @items end |
#metadata ⇒ Object
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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to metadata.
2392 2393 2394 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2392 def @metadata end |
#pause ⇒ Object
Previews the invoice that would be generated when pausing the subscription. Passing an empty hash won't preview pausing and instead returns the next invoice.
To receive a preview invoice, set invoicing_behavior to invoice. A preview isn't available if the bill_for options produce no billable amounts.
pending_invoice_item never has a preview available because pausing wouldn't generate an invoice, and paused subscriptions don't generate invoices either.
2398 2399 2400 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2398 def pause @pause end |
#prebilling ⇒ Object
The pre-billing to apply to the subscription as a preview.
2400 2401 2402 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2400 def prebilling @prebilling end |
#proration_behavior ⇒ Object
Determines how to handle 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.
2402 2403 2404 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2402 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'.
2404 2405 2406 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2404 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.
2406 2407 2408 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2406 def resume_at @resume_at end |
#start_date ⇒ Object
Date a subscription is intended to start (can be future or past).
2408 2409 2410 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2408 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.
2410 2411 2412 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2410 def trial_end @trial_end end |
Class Method Details
.field_encodings ⇒ Object
2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 |
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2448 def self.field_encodings @field_encodings = { items: { kind: :array, element: { kind: :object, fields: { price_data: { kind: :object, fields: { unit_amount_decimal: :decimal_string } } }, }, }, } end |