Class: Stripe::PlanService::CreateParams

Inherits:
RequestParams show all
Defined in:
lib/stripe/services/plan_service.rb

Defined Under Namespace

Classes: Product, Tier, TransformUsage

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RequestParams

#to_h

Constructor Details

#initialize(active: nil, amount: nil, amount_decimal: nil, billing_scheme: nil, currency: nil, expand: nil, id: nil, interval: nil, interval_count: nil, metadata: nil, meter: nil, nickname: nil, product: nil, tiers: nil, tiers_mode: nil, transform_usage: nil, trial_period_days: nil, usage_type: nil) ⇒ CreateParams

Returns a new instance of CreateParams.



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/stripe/services/plan_service.rb', line 214

def initialize(
  active: nil,
  amount: nil,
  amount_decimal: nil,
  billing_scheme: nil,
  currency: nil,
  expand: nil,
  id: nil,
  interval: nil,
  interval_count: nil,
  metadata: nil,
  meter: nil,
  nickname: nil,
  product: nil,
  tiers: nil,
  tiers_mode: nil,
  transform_usage: nil,
  trial_period_days: nil,
  usage_type: nil
)
  @active = active
  @amount = amount
  @amount_decimal = amount_decimal
  @billing_scheme = billing_scheme
  @currency = currency
  @expand = expand
  @id = id
  @interval = interval
  @interval_count = interval_count
  @metadata = 
  @meter = meter
  @nickname = nickname
  @product = product
  @tiers = tiers
  @tiers_mode = tiers_mode
  @transform_usage = transform_usage
  @trial_period_days = trial_period_days
  @usage_type = usage_type
end

Instance Attribute Details

#activeObject

Whether the plan is currently available for new subscriptions. Defaults to ‘true`.



178
179
180
# File 'lib/stripe/services/plan_service.rb', line 178

def active
  @active
end

#amountObject

A positive integer in cents (or local equivalent) (or 0 for a free plan) representing how much to charge on a recurring basis.



180
181
182
# File 'lib/stripe/services/plan_service.rb', line 180

def amount
  @amount
end

#amount_decimalObject

Same as ‘amount`, but accepts a decimal value with at most 12 decimal places. Only one of `amount` and `amount_decimal` can be set.



182
183
184
# File 'lib/stripe/services/plan_service.rb', line 182

def amount_decimal
  @amount_decimal
end

#billing_schemeObject

Describes how to compute the price per period. Either ‘per_unit` or `tiered`. `per_unit` indicates that the fixed amount (specified in `amount`) will be charged per unit in `quantity` (for plans with `usage_type=licensed`), or per unit of total usage (for plans with `usage_type=metered`). `tiered` indicates that the unit pricing will be computed using a tiering strategy as defined using the `tiers` and `tiers_mode` attributes.



184
185
186
# File 'lib/stripe/services/plan_service.rb', line 184

def billing_scheme
  @billing_scheme
end

#currencyObject

Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](stripe.com/docs/currencies).



186
187
188
# File 'lib/stripe/services/plan_service.rb', line 186

def currency
  @currency
end

#expandObject

Specifies which fields in the response should be expanded.



188
189
190
# File 'lib/stripe/services/plan_service.rb', line 188

def expand
  @expand
end

#idObject

An identifier randomly generated by Stripe. Used to identify this plan when subscribing a customer. You can optionally override this ID, but the ID must be unique across all plans in your Stripe account. You can, however, use the same plan ID in both live and test modes.



190
191
192
# File 'lib/stripe/services/plan_service.rb', line 190

def id
  @id
end

#intervalObject

Specifies billing frequency. Either ‘day`, `week`, `month` or `year`.



192
193
194
# File 'lib/stripe/services/plan_service.rb', line 192

def interval
  @interval
end

#interval_countObject

The number of intervals between subscription billings. For example, ‘interval=month` and `interval_count=3` bills every 3 months. Maximum of three years interval allowed (3 years, 36 months, or 156 weeks).



194
195
196
# File 'lib/stripe/services/plan_service.rb', line 194

def interval_count
  @interval_count
end

#metadataObject

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. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to ‘metadata`.



196
197
198
# File 'lib/stripe/services/plan_service.rb', line 196

def 
  @metadata
end

#meterObject

The meter tracking the usage of a metered price



198
199
200
# File 'lib/stripe/services/plan_service.rb', line 198

def meter
  @meter
end

#nicknameObject

A brief description of the plan, hidden from customers.



200
201
202
# File 'lib/stripe/services/plan_service.rb', line 200

def nickname
  @nickname
end

#productObject

Attribute for param field product



202
203
204
# File 'lib/stripe/services/plan_service.rb', line 202

def product
  @product
end

#tiersObject

Each element represents a pricing tier. This parameter requires ‘billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`.



204
205
206
# File 'lib/stripe/services/plan_service.rb', line 204

def tiers
  @tiers
end

#tiers_modeObject

Defines if the tiering price should be ‘graduated` or `volume` based. In `volume`-based tiering, the maximum quantity within a period determines the per unit price, in `graduated` tiering pricing can successively change as the quantity grows.



206
207
208
# File 'lib/stripe/services/plan_service.rb', line 206

def tiers_mode
  @tiers_mode
end

#transform_usageObject

Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with ‘tiers`.



208
209
210
# File 'lib/stripe/services/plan_service.rb', line 208

def transform_usage
  @transform_usage
end

#trial_period_daysObject

Default number of trial days when subscribing a customer to this plan using [‘trial_from_plan=true`](stripe.com/docs/api#create_subscription-trial_from_plan).



210
211
212
# File 'lib/stripe/services/plan_service.rb', line 210

def trial_period_days
  @trial_period_days
end

#usage_typeObject

Configures how the quantity per period should be determined. Can be either ‘metered` or `licensed`. `licensed` automatically bills the `quantity` set when adding it to a subscription. `metered` aggregates the total usage based on usage records. Defaults to `licensed`.



212
213
214
# File 'lib/stripe/services/plan_service.rb', line 212

def usage_type
  @usage_type
end