Skip to content

Calculate tax rates

POST
/estore/raw-purchase/_calculate-tax-rate
Required scope: viskan:order:create, viskan:subscription:create

Calculates tax rate for the given products.

NOTE: For US only: If there is no nexus in the state of the receiver, the tax rate will be zero, and amountExcludingTax will be equal to amountIncludingTax on all prices.

NOTE: When calculating amounts from quantities there might be some natural inconsistency between amountExcludingTax and amountIncludingTax due to the way we calculate tax per quantity (as opposed to the whole sum) and round half up for each quantity. This is true for both internal and external calculations, but only the "calculated" amount could potentially be different. For external calculations, only amountIncludingTax could differ.

Example:
External (US)

Request
unitPriceExcludingTax: 176.25
discountExcludingTax: 13.37
quantity: 2
(VAT: 30%)

Response
unitPriceIncludingTax: 229.13
unitPriceExcludingTax: 176.25
discountIncludingTax: 17.38
discountExcludingTax: 13.37
amountIncludingTax: 260.88
amountExcludingTax: 339.13

As a result, all calculations add up independently, but when you actually try to derive excluding vat from the amountIncludingTax, it does not add up.

176.25 * 2 - 13.36 = 339.14
229.13 * 2 - 17.38 = 440.88
but
339.13 * 1.3 = 440.8692307692308 ~= 440.87 != 440.88

This is correct, though, since what the customer sees and pays for is the price calculated for each qty (176.25 and 229.13).

Request body

Response

The tax rates were calculated successfully