Class: Stripe::OrderUpdateParams::LineItem

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

Defined Under Namespace

Classes: Discount, PriceData, ProductData

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(description: nil, discounts: nil, id: nil, price: nil, price_data: nil, product: nil, product_data: nil, quantity: nil, tax_rates: nil) ⇒ LineItem

Returns a new instance of LineItem.



247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
# File 'lib/stripe/params/order_update_params.rb', line 247

def initialize(
  description: nil,
  discounts: nil,
  id: nil,
  price: nil,
  price_data: nil,
  product: nil,
  product_data: nil,
  quantity: nil,
  tax_rates: nil
)
  @description = description
  @discounts = discounts
  @id = id
  @price = price
  @price_data = price_data
  @product = product
  @product_data = product_data
  @quantity = quantity
  @tax_rates = tax_rates
end

Instance Attribute Details

#descriptionObject

The description for the line item. Will default to the name of the associated product.



217
218
219
# File 'lib/stripe/params/order_update_params.rb', line 217

def description
  @description
end

#discountsObject

The discounts applied to this line item.



219
220
221
# File 'lib/stripe/params/order_update_params.rb', line 219

def discounts
  @discounts
end

#idObject

The ID of an existing line item on the order.



221
222
223
# File 'lib/stripe/params/order_update_params.rb', line 221

def id
  @id
end

#priceObject

The ID of a [Price](docs.stripe.com/api/prices) to add to the Order.

The ‘price` parameter is an alternative to using the `product` parameter. If each of your products are sold at a single price, you can set `Product.default_price` and then pass the `product` parameter when creating a line item. If your products are sold at several possible prices, use the `price` parameter to explicitly specify which one to use.



225
226
227
# File 'lib/stripe/params/order_update_params.rb', line 225

def price
  @price
end

#price_dataObject

Data used to generate a new Price object inline.

The ‘price_data` parameter is an alternative to using the `product` or `price` parameters. If you create a Product upfront and configure a `Product.default_price`, pass the `product` parameter when creating a line item. If you prefer not to define Products upfront, or if you charge variable prices, pass the `price_data` parameter to describe the price for this line item.

Each time you pass ‘price_data` we create a Price for the Product. This Price is hidden in both the Dashboard and API lists and cannot be reused.



231
232
233
# File 'lib/stripe/params/order_update_params.rb', line 231

def price_data
  @price_data
end

#productObject

The ID of a [Product](docs.stripe.com/api/products) to add to the Order.

The Product must have a ‘default_price` specified. Otherwise, specify the price by passing the `price` or `price_data` parameter.



235
236
237
# File 'lib/stripe/params/order_update_params.rb', line 235

def product
  @product
end

#product_dataObject

Defines a [Product](docs.stripe.com/api/products) inline and adds it to the Order.

‘product_data` is an alternative to the `product` parameter. If you created a Product upfront, use the `product` parameter to refer to the existing Product. But if you prefer not to create Products upfront, pass the `product_data` parameter to define a Product inline as part of configuring the Order.

‘product_data` automatically creates a Product, just as if you had manually created the Product. If a Product with the same ID already exists, then `product_data` re-uses it to avoid duplicates.



241
242
243
# File 'lib/stripe/params/order_update_params.rb', line 241

def product_data
  @product_data
end

#quantityObject

The quantity of the line item.



243
244
245
# File 'lib/stripe/params/order_update_params.rb', line 243

def quantity
  @quantity
end

#tax_ratesObject

The tax rates applied to this line item.



245
246
247
# File 'lib/stripe/params/order_update_params.rb', line 245

def tax_rates
  @tax_rates
end

Class Method Details

.field_encodingsObject



269
270
271
272
273
# File 'lib/stripe/params/order_update_params.rb', line 269

def self.field_encodings
  @field_encodings = {
    price_data: { kind: :object, fields: { unit_amount_decimal: :decimal_string } },
  }
end