Class: Stripe::Tax::Calculation::CreateParams::LineItem

Inherits:
RequestParams
  • Object
show all
Defined in:
lib/stripe/resources/tax/calculation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RequestParams

#to_h

Constructor Details

#initialize(amount: nil, product: nil, quantity: nil, reference: nil, tax_behavior: nil, tax_code: nil) ⇒ LineItem

Returns a new instance of LineItem.



263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/stripe/resources/tax/calculation.rb', line 263

def initialize(
  amount: nil,
  product: nil,
  quantity: nil,
  reference: nil,
  tax_behavior: nil,
  tax_code: nil
)
  @amount = amount
  @product = product
  @quantity = quantity
  @reference = reference
  @tax_behavior = tax_behavior
  @tax_code = tax_code
end

Instance Attribute Details

#amountObject

A positive integer representing the line item’s total price in the [smallest currency unit](stripe.com/docs/currencies#zero-decimal). If ‘tax_behavior=inclusive`, then this amount includes taxes. Otherwise, taxes are calculated on top of this amount.



251
252
253
# File 'lib/stripe/resources/tax/calculation.rb', line 251

def amount
  @amount
end

#productObject

If provided, the product’s ‘tax_code` will be used as the line item’s ‘tax_code`.



253
254
255
# File 'lib/stripe/resources/tax/calculation.rb', line 253

def product
  @product
end

#quantityObject

The number of units of the item being purchased. Used to calculate the per-unit price from the total ‘amount` for the line. For example, if `amount=100` and `quantity=4`, the calculated unit price is 25.



255
256
257
# File 'lib/stripe/resources/tax/calculation.rb', line 255

def quantity
  @quantity
end

#referenceObject

A custom identifier for this line item, which must be unique across the line items in the calculation. The reference helps identify each line item in exported [tax reports](stripe.com/docs/tax/reports).



257
258
259
# File 'lib/stripe/resources/tax/calculation.rb', line 257

def reference
  @reference
end

#tax_behaviorObject

Specifies whether the ‘amount` includes taxes. Defaults to `exclusive`.



259
260
261
# File 'lib/stripe/resources/tax/calculation.rb', line 259

def tax_behavior
  @tax_behavior
end

#tax_codeObject

A [tax code](stripe.com/docs/tax/tax-categories) ID to use for this line item. If not provided, we will use the tax code from the provided ‘product` param. If neither `tax_code` nor `product` is provided, we will use the default tax code from your Tax Settings.



261
262
263
# File 'lib/stripe/resources/tax/calculation.rb', line 261

def tax_code
  @tax_code
end