Class: Stripe::PlanCreateParams::Tier

Inherits:
RequestParams show all
Defined in:
lib/stripe/params/plan_create_params.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RequestParams

attr_accessor, coerce_params, coerce_value, new, #to_h

Constructor Details

#initialize(flat_amount: nil, flat_amount_decimal: nil, unit_amount: nil, unit_amount_decimal: nil, up_to: nil) ⇒ Tier

Returns a new instance of Tier.



70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/stripe/params/plan_create_params.rb', line 70

def initialize(
  flat_amount: nil,
  flat_amount_decimal: nil,
  unit_amount: nil,
  unit_amount_decimal: nil,
  up_to: nil
)
  @flat_amount = flat_amount
  @flat_amount_decimal = flat_amount_decimal
  @unit_amount = unit_amount
  @unit_amount_decimal = unit_amount_decimal
  @up_to = up_to
end

Instance Attribute Details

#flat_amountObject

The flat billing amount for an entire tier, regardless of the number of units in the tier.



60
61
62
# File 'lib/stripe/params/plan_create_params.rb', line 60

def flat_amount
  @flat_amount
end

#flat_amount_decimalObject

Same as ‘flat_amount`, but accepts a decimal value representing an integer in the minor units of the currency. Only one of `flat_amount` and `flat_amount_decimal` can be set.



62
63
64
# File 'lib/stripe/params/plan_create_params.rb', line 62

def flat_amount_decimal
  @flat_amount_decimal
end

#unit_amountObject

The per unit billing amount for each individual unit for which this tier applies.



64
65
66
# File 'lib/stripe/params/plan_create_params.rb', line 64

def unit_amount
  @unit_amount
end

#unit_amount_decimalObject

Same as ‘unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.



66
67
68
# File 'lib/stripe/params/plan_create_params.rb', line 66

def unit_amount_decimal
  @unit_amount_decimal
end

#up_toObject

Specifies the upper bound of this tier. The lower bound of a tier is the upper bound of the previous tier adding one. Use ‘inf` to define a fallback tier.



68
69
70
# File 'lib/stripe/params/plan_create_params.rb', line 68

def up_to
  @up_to
end

Class Method Details

.field_encodingsObject



84
85
86
87
88
89
# File 'lib/stripe/params/plan_create_params.rb', line 84

def self.field_encodings
  @field_encodings = {
    flat_amount_decimal: :decimal_string,
    unit_amount_decimal: :decimal_string,
  }
end