Class: Stripe::Invoice::CreatePreviewParams::SubscriptionDetails

Inherits:
RequestParams
  • Object
show all
Defined in:
lib/stripe/resources/invoice.rb

Defined Under Namespace

Classes: BillingMode, Item

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RequestParams

#to_h

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

Returns a new instance of SubscriptionDetails.



3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
# File 'lib/stripe/resources/invoice.rb', line 3137

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,
  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
  @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](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`.



3113
3114
3115
# File 'lib/stripe/resources/invoice.rb', line 3113

def billing_cycle_anchor
  @billing_cycle_anchor
end

#billing_modeObject

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



3115
3116
3117
# File 'lib/stripe/resources/invoice.rb', line 3115

def billing_mode
  @billing_mode
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.



3117
3118
3119
# File 'lib/stripe/resources/invoice.rb', line 3117

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



3119
3120
3121
# File 'lib/stripe/resources/invoice.rb', line 3119

def cancel_at_period_end
  @cancel_at_period_end
end

#cancel_nowObject

This simulates the subscription being canceled or expired immediately.



3121
3122
3123
# File 'lib/stripe/resources/invoice.rb', line 3121

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.



3123
3124
3125
# File 'lib/stripe/resources/invoice.rb', line 3123

def default_tax_rates
  @default_tax_rates
end

#itemsObject

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



3125
3126
3127
# File 'lib/stripe/resources/invoice.rb', line 3125

def items
  @items
end

#proration_behaviorObject

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



3127
3128
3129
# File 'lib/stripe/resources/invoice.rb', line 3127

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



3129
3130
3131
# File 'lib/stripe/resources/invoice.rb', line 3129

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.



3131
3132
3133
# File 'lib/stripe/resources/invoice.rb', line 3131

def resume_at
  @resume_at
end

#start_dateObject

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



3133
3134
3135
# File 'lib/stripe/resources/invoice.rb', line 3133

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.



3135
3136
3137
# File 'lib/stripe/resources/invoice.rb', line 3135

def trial_end
  @trial_end
end