Class: Stripe::Plan::CreateParams
- Inherits:
-
RequestParams
- Object
- RequestParams
- Stripe::Plan::CreateParams
- Defined in:
- lib/stripe/resources/plan.rb
Defined Under Namespace
Classes: Product, Tier, TransformUsage
Instance Attribute Summary collapse
-
#active ⇒ Object
Whether the plan is currently available for new subscriptions.
-
#aggregate_usage ⇒ Object
Specifies a usage aggregation strategy for plans of ‘usage_type=metered`.
-
#amount ⇒ Object
A positive integer in cents (or local equivalent) (or 0 for a free plan) representing how much to charge on a recurring basis.
-
#amount_decimal ⇒ Object
Same as ‘amount`, but accepts a decimal value with at most 12 decimal places.
-
#billing_scheme ⇒ Object
Describes how to compute the price per period.
-
#currency ⇒ Object
Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase.
-
#expand ⇒ Object
Specifies which fields in the response should be expanded.
-
#id ⇒ Object
An identifier randomly generated by Stripe.
-
#interval ⇒ Object
Specifies billing frequency.
-
#interval_count ⇒ Object
The number of intervals between subscription billings.
-
#metadata ⇒ Object
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object.
-
#meter ⇒ Object
The meter tracking the usage of a metered price.
-
#nickname ⇒ Object
A brief description of the plan, hidden from customers.
-
#product ⇒ Object
Attribute for param field product.
-
#tiers ⇒ Object
Each element represents a pricing tier.
-
#tiers_mode ⇒ Object
Defines if the tiering price should be ‘graduated` or `volume` based.
-
#transform_usage ⇒ Object
Apply a transformation to the reported usage or set quantity before computing the billed price.
-
#trial_period_days ⇒ Object
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).
-
#usage_type ⇒ Object
Configures how the quantity per period should be determined.
Instance Method Summary collapse
-
#initialize(active: nil, aggregate_usage: 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
constructor
A new instance of CreateParams.
Methods inherited from RequestParams
Constructor Details
#initialize(active: nil, aggregate_usage: 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.
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/stripe/resources/plan.rb', line 254 def initialize( active: nil, aggregate_usage: 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 @aggregate_usage = aggregate_usage @amount = amount @amount_decimal = amount_decimal @billing_scheme = billing_scheme @currency = currency @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
#active ⇒ Object
Whether the plan is currently available for new subscriptions. Defaults to ‘true`.
216 217 218 |
# File 'lib/stripe/resources/plan.rb', line 216 def active @active end |
#aggregate_usage ⇒ Object
Specifies a usage aggregation strategy for plans of ‘usage_type=metered`. Allowed values are `sum` for summing up all usage during a period, `last_during_period` for using the last usage record reported within a period, `last_ever` for using the last usage record ever (across period bounds) or `max` which uses the usage record with the maximum reported usage during a period. Defaults to `sum`.
218 219 220 |
# File 'lib/stripe/resources/plan.rb', line 218 def aggregate_usage @aggregate_usage end |
#amount ⇒ Object
A positive integer in cents (or local equivalent) (or 0 for a free plan) representing how much to charge on a recurring basis.
220 221 222 |
# File 'lib/stripe/resources/plan.rb', line 220 def amount @amount end |
#amount_decimal ⇒ Object
Same as ‘amount`, but accepts a decimal value with at most 12 decimal places. Only one of `amount` and `amount_decimal` can be set.
222 223 224 |
# File 'lib/stripe/resources/plan.rb', line 222 def amount_decimal @amount_decimal end |
#billing_scheme ⇒ Object
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.
224 225 226 |
# File 'lib/stripe/resources/plan.rb', line 224 def billing_scheme @billing_scheme end |
#currency ⇒ Object
Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](stripe.com/docs/currencies).
226 227 228 |
# File 'lib/stripe/resources/plan.rb', line 226 def currency @currency end |
#expand ⇒ Object
Specifies which fields in the response should be expanded.
228 229 230 |
# File 'lib/stripe/resources/plan.rb', line 228 def @expand end |
#id ⇒ Object
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.
230 231 232 |
# File 'lib/stripe/resources/plan.rb', line 230 def id @id end |
#interval ⇒ Object
Specifies billing frequency. Either ‘day`, `week`, `month` or `year`.
232 233 234 |
# File 'lib/stripe/resources/plan.rb', line 232 def interval @interval end |
#interval_count ⇒ Object
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).
234 235 236 |
# File 'lib/stripe/resources/plan.rb', line 234 def interval_count @interval_count end |
#metadata ⇒ Object
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`.
236 237 238 |
# File 'lib/stripe/resources/plan.rb', line 236 def @metadata end |
#meter ⇒ Object
The meter tracking the usage of a metered price
238 239 240 |
# File 'lib/stripe/resources/plan.rb', line 238 def meter @meter end |
#nickname ⇒ Object
A brief description of the plan, hidden from customers.
240 241 242 |
# File 'lib/stripe/resources/plan.rb', line 240 def nickname @nickname end |
#product ⇒ Object
Attribute for param field product
242 243 244 |
# File 'lib/stripe/resources/plan.rb', line 242 def product @product end |
#tiers ⇒ Object
Each element represents a pricing tier. This parameter requires ‘billing_scheme` to be set to `tiered`. See also the documentation for `billing_scheme`.
244 245 246 |
# File 'lib/stripe/resources/plan.rb', line 244 def tiers @tiers end |
#tiers_mode ⇒ Object
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.
246 247 248 |
# File 'lib/stripe/resources/plan.rb', line 246 def tiers_mode @tiers_mode end |
#transform_usage ⇒ Object
Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with ‘tiers`.
248 249 250 |
# File 'lib/stripe/resources/plan.rb', line 248 def transform_usage @transform_usage end |
#trial_period_days ⇒ Object
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).
250 251 252 |
# File 'lib/stripe/resources/plan.rb', line 250 def trial_period_days @trial_period_days end |
#usage_type ⇒ Object
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`.
252 253 254 |
# File 'lib/stripe/resources/plan.rb', line 252 def usage_type @usage_type end |