Class: Stripe::PriceCreateParams
- Inherits:
-
RequestParams
- Object
- RequestParams
- Stripe::PriceCreateParams
- Defined in:
- lib/stripe/params/price_create_params.rb
Defined Under Namespace
Classes: CurrencyOptions, CustomUnitAmount, ProductData, Recurring, Tier, TransformQuantity
Instance Attribute Summary collapse
-
#active ⇒ Object
Whether the price can be used for new purchases.
-
#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.
-
#currency_options ⇒ Object
Prices defined in each available currency option.
-
#custom_unit_amount ⇒ Object
When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links.
-
#expand ⇒ Object
Specifies which fields in the response should be expanded.
-
#lookup_key ⇒ Object
A lookup key used to retrieve prices dynamically from a static string.
-
#metadata ⇒ Object
Set of [key-value pairs](docs.stripe.com/api/metadata) that you can attach to an object.
-
#nickname ⇒ Object
A brief description of the price, hidden from customers.
-
#product ⇒ Object
The ID of the [Product](docs.stripe.com/api/products) that this [Price](docs.stripe.com/api/prices) will belong to.
-
#product_data ⇒ Object
These fields can be used to create a new product that this price will belong to.
-
#recurring ⇒ Object
The recurring components of a price such as ‘interval` and `usage_type`.
-
#tax_behavior ⇒ Object
Only required if a [default tax behavior](docs.stripe.com/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings.
-
#tiers ⇒ Object
Each element represents a pricing tier.
-
#tiers_mode ⇒ Object
Defines if the tiering price should be ‘graduated` or `volume` based.
-
#transfer_lookup_key ⇒ Object
If set to true, will atomically remove the lookup key from the existing price, and assign it to this price.
-
#transform_quantity ⇒ Object
Apply a transformation to the reported usage or set quantity before computing the billed price.
-
#unit_amount ⇒ Object
A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge.
-
#unit_amount_decimal ⇒ Object
Same as ‘unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(active: nil, billing_scheme: nil, currency: nil, currency_options: nil, custom_unit_amount: nil, expand: nil, lookup_key: nil, metadata: nil, nickname: nil, product: nil, product_data: nil, recurring: nil, tax_behavior: nil, tiers: nil, tiers_mode: nil, transfer_lookup_key: nil, transform_quantity: nil, unit_amount: nil, unit_amount_decimal: nil) ⇒ PriceCreateParams
constructor
A new instance of PriceCreateParams.
Methods inherited from RequestParams
attr_accessor, coerce_params, coerce_value, new, #to_h
Constructor Details
#initialize(active: nil, billing_scheme: nil, currency: nil, currency_options: nil, custom_unit_amount: nil, expand: nil, lookup_key: nil, metadata: nil, nickname: nil, product: nil, product_data: nil, recurring: nil, tax_behavior: nil, tiers: nil, tiers_mode: nil, transfer_lookup_key: nil, transform_quantity: nil, unit_amount: nil, unit_amount_decimal: nil) ⇒ PriceCreateParams
Returns a new instance of PriceCreateParams.
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
# File 'lib/stripe/params/price_create_params.rb', line 278 def initialize( active: nil, billing_scheme: nil, currency: nil, currency_options: nil, custom_unit_amount: nil, expand: nil, lookup_key: nil, metadata: nil, nickname: nil, product: nil, product_data: nil, recurring: nil, tax_behavior: nil, tiers: nil, tiers_mode: nil, transfer_lookup_key: nil, transform_quantity: nil, unit_amount: nil, unit_amount_decimal: nil ) @active = active @billing_scheme = billing_scheme @currency = currency @currency_options = @custom_unit_amount = custom_unit_amount @expand = @lookup_key = lookup_key @metadata = @nickname = nickname @product = product @product_data = product_data @recurring = recurring @tax_behavior = tax_behavior @tiers = tiers @tiers_mode = tiers_mode @transfer_lookup_key = transfer_lookup_key @transform_quantity = transform_quantity @unit_amount = unit_amount @unit_amount_decimal = unit_amount_decimal end |
Instance Attribute Details
#active ⇒ Object
Whether the price can be used for new purchases. Defaults to ‘true`.
240 241 242 |
# File 'lib/stripe/params/price_create_params.rb', line 240 def active @active 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 `unit_amount` or `unit_amount_decimal`) will be charged per unit in `quantity` (for prices with `usage_type=licensed`), or per unit of total usage (for prices 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.
242 243 244 |
# File 'lib/stripe/params/price_create_params.rb', line 242 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).
244 245 246 |
# File 'lib/stripe/params/price_create_params.rb', line 244 def currency @currency end |
#currency_options ⇒ Object
Prices defined in each available currency option. Each key must be a three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html) and a [supported currency](stripe.com/docs/currencies).
246 247 248 |
# File 'lib/stripe/params/price_create_params.rb', line 246 def @currency_options end |
#custom_unit_amount ⇒ Object
When set, provides configuration for the amount to be adjusted by the customer during Checkout Sessions and Payment Links.
248 249 250 |
# File 'lib/stripe/params/price_create_params.rb', line 248 def custom_unit_amount @custom_unit_amount end |
#expand ⇒ Object
Specifies which fields in the response should be expanded.
250 251 252 |
# File 'lib/stripe/params/price_create_params.rb', line 250 def @expand end |
#lookup_key ⇒ Object
A lookup key used to retrieve prices dynamically from a static string. This may be up to 200 characters.
252 253 254 |
# File 'lib/stripe/params/price_create_params.rb', line 252 def lookup_key @lookup_key end |
#metadata ⇒ Object
Set of [key-value pairs](docs.stripe.com/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`.
254 255 256 |
# File 'lib/stripe/params/price_create_params.rb', line 254 def @metadata end |
#nickname ⇒ Object
A brief description of the price, hidden from customers.
256 257 258 |
# File 'lib/stripe/params/price_create_params.rb', line 256 def nickname @nickname end |
#product ⇒ Object
The ID of the [Product](docs.stripe.com/api/products) that this [Price](docs.stripe.com/api/prices) will belong to.
258 259 260 |
# File 'lib/stripe/params/price_create_params.rb', line 258 def product @product end |
#product_data ⇒ Object
These fields can be used to create a new product that this price will belong to.
260 261 262 |
# File 'lib/stripe/params/price_create_params.rb', line 260 def product_data @product_data end |
#recurring ⇒ Object
The recurring components of a price such as ‘interval` and `usage_type`.
262 263 264 |
# File 'lib/stripe/params/price_create_params.rb', line 262 def recurring @recurring end |
#tax_behavior ⇒ Object
Only required if a [default tax behavior](docs.stripe.com/tax/products-prices-tax-categories-tax-behavior#setting-a-default-tax-behavior-(recommended)) was not provided in the Stripe Tax settings. Specifies whether the price is considered inclusive of taxes or exclusive of taxes. One of ‘inclusive`, `exclusive`, or `unspecified`. Once specified as either `inclusive` or `exclusive`, it cannot be changed.
264 265 266 |
# File 'lib/stripe/params/price_create_params.rb', line 264 def tax_behavior @tax_behavior 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`.
266 267 268 |
# File 'lib/stripe/params/price_create_params.rb', line 266 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.
268 269 270 |
# File 'lib/stripe/params/price_create_params.rb', line 268 def tiers_mode @tiers_mode end |
#transfer_lookup_key ⇒ Object
If set to true, will atomically remove the lookup key from the existing price, and assign it to this price.
270 271 272 |
# File 'lib/stripe/params/price_create_params.rb', line 270 def transfer_lookup_key @transfer_lookup_key end |
#transform_quantity ⇒ Object
Apply a transformation to the reported usage or set quantity before computing the billed price. Cannot be combined with ‘tiers`.
272 273 274 |
# File 'lib/stripe/params/price_create_params.rb', line 272 def transform_quantity @transform_quantity end |
#unit_amount ⇒ Object
A positive integer in cents (or local equivalent) (or 0 for a free price) representing how much to charge. One of ‘unit_amount`, `unit_amount_decimal`, or `custom_unit_amount` is required, unless `billing_scheme=tiered`.
274 275 276 |
# File 'lib/stripe/params/price_create_params.rb', line 274 def unit_amount @unit_amount end |
#unit_amount_decimal ⇒ Object
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.
276 277 278 |
# File 'lib/stripe/params/price_create_params.rb', line 276 def unit_amount_decimal @unit_amount_decimal end |
Class Method Details
.field_encodings ⇒ Object
320 321 322 323 324 325 326 327 328 329 330 331 |
# File 'lib/stripe/params/price_create_params.rb', line 320 def self.field_encodings @field_encodings = { tiers: { kind: :array, element: { kind: :object, fields: { flat_amount_decimal: :decimal_string, unit_amount_decimal: :decimal_string }, }, }, unit_amount_decimal: :decimal_string, } end |