Class: Stripe::Tax::CalculationService::CreateParams::LineItem

Inherits:
RequestParams
  • Object
show all
Defined in:
lib/stripe/services/tax/calculation_service.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.



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/stripe/services/tax/calculation_service.rb', line 108

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.



96
97
98
# File 'lib/stripe/services/tax/calculation_service.rb', line 96

def amount
  @amount
end

#productObject

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



98
99
100
# File 'lib/stripe/services/tax/calculation_service.rb', line 98

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.



100
101
102
# File 'lib/stripe/services/tax/calculation_service.rb', line 100

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



102
103
104
# File 'lib/stripe/services/tax/calculation_service.rb', line 102

def reference
  @reference
end

#tax_behaviorObject

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



104
105
106
# File 'lib/stripe/services/tax/calculation_service.rb', line 104

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.



106
107
108
# File 'lib/stripe/services/tax/calculation_service.rb', line 106

def tax_code
  @tax_code
end