Class LineItemTax

A tax on a line item: tax identifier, rate, and optional amount. Use with LineItem.setTaxes(Collection) and LineItem.getTaxes().

Create instances via new LineItemTax(taxId, taxRate) to have the server compute the tax value, or via new LineItemTax(taxId, taxRate, taxValue) to provide a pre-computed tax value.

See Also:

Property Summary 

PropertyDescription
taxId: String (read-only)Gets the tax identifier (for example,
taxRate: Number (read-only)Gets the tax rate as a decimal (for example,
taxValue: Money (read-only)Gets the tax value (amount) in purchase currency, or null if computed from rate and tax basis.

Constructor Summary 

ConstructorDescription
LineItemTax(String, Number)Creates a tax item for use with LineItem.setTaxes(Collection).
LineItemTax(String, Number, Money)Creates a tax item for use with LineItem.setTaxes(Collection).

Method Summary 

MethodDescription
getTaxId()Gets the tax identifier (for example,
getTaxRate()Gets the tax rate as a decimal (for example,
getTaxValue()Gets the tax value (amount) in purchase currency, or null if computed from rate and tax basis.

Methods inherited from class Object 

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

Property Details 

taxId 

taxId: String (read-only)

Gets the tax identifier (for example, "DE_7").


taxRate 

taxRate: Number (read-only)

Gets the tax rate as a decimal (for example, 0.07 for 7%).


taxValue 

taxValue: Money (read-only)

Gets the tax value (amount) in purchase currency, or null if computed from rate and tax basis.


Constructor Details 

LineItemTax(String, Number) 

LineItemTax(taxId: String, taxRate: Number)

Creates a tax item for use with LineItem.setTaxes(Collection). The tax value will be computed server-side from the tax rate and the line item's tax basis.

Parameters:

  • taxId - tax identifier (for example, "DE_7"), must not be null or blank
  • taxRate - tax rate as decimal (for example, 0.07 for 7%), must not be null

LineItemTax(String, Number, Money) 

LineItemTax(taxId: String, taxRate: Number, taxValue: Money)

Creates a tax item for use with LineItem.setTaxes(Collection).

Parameters:

  • taxId - tax identifier (for example, "DE_7"), must not be null or blank
  • taxRate - tax rate as decimal (for example, 0.07 for 7%), must not be null
  • taxValue - tax amount in purchase currency, or null to compute from rate and tax basis

Method Details 

getTaxId() 

getTaxId(): String

Gets the tax identifier (for example, "DE_7").

Returns:

  • the tax id

getTaxRate() 

getTaxRate(): Number

Gets the tax rate as a decimal (for example, 0.07 for 7%).

Returns:

  • the tax rate

getTaxValue() 

getTaxValue(): Money

Gets the tax value (amount) in purchase currency, or null if computed from rate and tax basis.

Returns:

  • the tax value as Money, or null