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, metadata: nil, product: nil, quantity: nil, reference: nil, tax_behavior: nil, tax_code: nil) ⇒ LineItem

Returns a new instance of LineItem.



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/stripe/resources/tax/calculation.rb', line 352

def initialize(
  amount: nil,
  metadata: nil,
  product: nil,
  quantity: nil,
  reference: nil,
  tax_behavior: nil,
  tax_code: nil
)
  @amount = amount
  @metadata = 
  @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.



338
339
340
# File 'lib/stripe/resources/tax/calculation.rb', line 338

def amount
  @amount
end

#metadataObject

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



340
341
342
# File 'lib/stripe/resources/tax/calculation.rb', line 340

def 
  @metadata
end

#productObject

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



342
343
344
# File 'lib/stripe/resources/tax/calculation.rb', line 342

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.



344
345
346
# File 'lib/stripe/resources/tax/calculation.rb', line 344

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).



346
347
348
# File 'lib/stripe/resources/tax/calculation.rb', line 346

def reference
  @reference
end

#tax_behaviorObject

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



348
349
350
# File 'lib/stripe/resources/tax/calculation.rb', line 348

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.



350
351
352
# File 'lib/stripe/resources/tax/calculation.rb', line 350

def tax_code
  @tax_code
end