Class: Stripe::InvoiceCreatePreviewParams::SubscriptionDetails

Inherits:
RequestParams
  • Object
show all
Defined in:
lib/stripe/params/invoice_create_preview_params.rb

Defined Under Namespace

Classes: BillingMode, BillingSchedule, Item, Prebilling

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RequestParams

#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, prebilling: nil, proration_behavior: nil, proration_date: nil, resume_at: nil, start_date: nil, trial_end: nil) ⇒ SubscriptionDetails

Returns a new instance of SubscriptionDetails.



2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2244

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,
  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
  @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_anchorObject

For new subscriptions, a future timestamp to anchor the subscription’s [billing cycle](docs.stripe.com/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`.



2216
2217
2218
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2216

def billing_cycle_anchor
  @billing_cycle_anchor
end

#billing_modeObject

Controls how prorations and invoices for subscriptions are calculated and orchestrated.



2218
2219
2220
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2218

def billing_mode
  @billing_mode
end

#billing_schedulesObject

Sets the billing schedules for the subscription.



2220
2221
2222
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2220

def billing_schedules
  @billing_schedules
end

#cancel_atObject

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.



2222
2223
2224
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2222

def cancel_at
  @cancel_at
end

#cancel_at_period_endObject

Indicate whether this subscription should cancel at the end of the current period (‘current_period_end`). Defaults to `false`.



2224
2225
2226
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2224

def cancel_at_period_end
  @cancel_at_period_end
end

#cancel_nowObject

This simulates the subscription being canceled or expired immediately.



2226
2227
2228
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2226

def cancel_now
  @cancel_now
end

#default_tax_ratesObject

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.



2228
2229
2230
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2228

def default_tax_rates
  @default_tax_rates
end

#itemsObject

A list of up to 20 subscription items, each with an attached price.



2230
2231
2232
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2230

def items
  @items
end

#prebillingObject

The pre-billing to apply to the subscription as a preview.



2232
2233
2234
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2232

def prebilling
  @prebilling
end

#proration_behaviorObject

Determines how to handle [prorations](docs.stripe.com/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`.



2234
2235
2236
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2234

def proration_behavior
  @proration_behavior
end

#proration_dateObject

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



2236
2237
2238
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2236

def proration_date
  @proration_date
end

#resume_atObject

For paused subscriptions, setting ‘subscription_details.resume_at` to `now` will preview the invoice that will be generated if the subscription is resumed.



2238
2239
2240
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2238

def resume_at
  @resume_at
end

#start_dateObject

Date a subscription is intended to start (can be future or past).



2240
2241
2242
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2240

def start_date
  @start_date
end

#trial_endObject

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.



2242
2243
2244
# File 'lib/stripe/params/invoice_create_preview_params.rb', line 2242

def trial_end
  @trial_end
end