Class: Stripe::V2::Billing::RateCardRate

Inherits:
APIResource show all
Defined in:
lib/stripe/resources/v2/billing/rate_card_rate.rb

Overview

A Rate Card Rate represents a single usage-based price within a Rate Card. Each rate binds to one Metered Item and defines the pricing structure for that item, including either a flat unit amount or tiered pricing. Rates support features like graduated or volume-based tiering, quantity transformations, and custom pricing units.

Defined Under Namespace

Classes: CustomPricingUnitAmount, Tier, TransformQuantity

Constant Summary collapse

OBJECT_NAME =
"v2.billing.rate_card_rate"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary collapse

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Methods inherited from APIResource

class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource

Methods included from APIOperations::Request

included

Methods inherited from StripeObject

#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values

Constructor Details

This class inherits a constructor from Stripe::StripeObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject

Instance Attribute Details

#createdObject (readonly)

Timestamp of when the object was created.



77
78
79
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 77

def created
  @created
end

#custom_pricing_unit_amountObject (readonly)

The custom pricing unit that this rate binds to.



79
80
81
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 79

def custom_pricing_unit_amount
  @custom_pricing_unit_amount
end

#idObject (readonly)

Unique identifier for the object.



81
82
83
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 81

def id
  @id
end

#livemodeObject (readonly)

Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.



83
84
85
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 83

def livemode
  @livemode
end

#metadataObject (readonly)

Set of [key-value pairs](/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.



85
86
87
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 85

def 
  @metadata
end

#metered_itemObject (readonly)

A Metered Item represents a billable item whose pricing is based on usage, measured by a meter. You can use rate cards to specify the pricing and create subscriptions to these items.



88
89
90
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 88

def metered_item
  @metered_item
end

#objectObject (readonly)

String representing the object’s type. Objects of the same type share the same value of the object field.



90
91
92
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 90

def object
  @object
end

#rate_cardObject (readonly)

The ID of the Rate Card it belongs to.



92
93
94
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 92

def rate_card
  @rate_card
end

#rate_card_versionObject (readonly)

The ID of the Rate Card Version it was created on.



94
95
96
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 94

def rate_card_version
  @rate_card_version
end

#tiering_modeObject (readonly)

Defines whether the tiering price is graduated or volume-based. In volume-based tiering, the maximum quantity within a period determines the per-unit price. In graduated tiering, the pricing changes as the quantity grows into new tiers. Can only be set if ‘tiers` is set.



98
99
100
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 98

def tiering_mode
  @tiering_mode
end

#tiersObject (readonly)

Each element represents a pricing tier. Cannot be set if ‘unit_amount` is provided.



100
101
102
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 100

def tiers
  @tiers
end

#transform_quantityObject (readonly)

Apply a transformation to the reported usage or set quantity before computing the amount billed.



102
103
104
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 102

def transform_quantity
  @transform_quantity
end

#unit_amountObject (readonly)

The per-unit amount to be charged, represented as a decimal string in minor currency units with at most 12 decimal places. Cannot be set if ‘tiers` is provided.



105
106
107
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 105

def unit_amount
  @unit_amount
end

Class Method Details

.field_encodingsObject



119
120
121
122
123
124
125
126
127
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 119

def self.field_encodings
  @field_encodings = {
    tiers: {
      kind: :array,
      element: { kind: :object, fields: { up_to_decimal: :decimal_string } },
    },
    transform_quantity: { kind: :object, fields: { divide_by: :int64_string } },
  }
end

.field_remappingsObject



115
116
117
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 115

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



107
108
109
110
111
112
113
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 107

def self.inner_class_types
  @inner_class_types = {
    custom_pricing_unit_amount: CustomPricingUnitAmount,
    tiers: Tier,
    transform_quantity: TransformQuantity,
  }
end

.object_nameObject



12
13
14
# File 'lib/stripe/resources/v2/billing/rate_card_rate.rb', line 12

def self.object_name
  "v2.billing.rate_card_rate"
end