Skip to content
Light
English

Demander API - Order Tax Calculation

This article is part of the REST Integration API documentation.

You calculate the IPI, the ICMS-ST and the additional fee of an order that has not been saved yet. Nothing is saved.

The calculation uses the tax rules stored for your company. Tax calculated in Sankhya, Avalara or Focco is not part of this route.

Rota: {host}/public/v1/calcular-impostos-pedido
Método: POST
Body: json

The response comes with status 200, with the totals and the tax of each item.

Property Type Required Description
uniqueIdCliente string ✓ Customer identifier. From it, Demander knows the state, the tax type and the segments.
codTipoPedido string or int ✓ Order type. Defines whether IPI, ICMS-ST and the additional fee are included.
codListaPreco string or int ✓ Price list. Defines whether the price already includes tax and, when the rule is per unit, the IPI of each unit.
codFilial string or int Branch. Used when choosing the tax rule.
codTipoDesconto string or int Discount type. Used when choosing the tax rule.
valorFrete number Freight. Included in the tax base when your company considers freight in this calculation. If you omit it, the value is 0.
valorDespesasAcessorias number Additional expenses. Included in the same base as freight. If you omit it, the value is 0.
descontoDestacado number Only reduces the order total in the response. It is not part of the tax base. If you omit it, the value is 0.
itensPedido array ✓ Items. Send at least one.

Each itensPedido item:

Property Type Required Description
codProduto string ✓ Product code.
qtde number ✓ Quantity.
valorUnitarioSemDesconto number ✓ List unit price, before discount.
valorUnitarioComDesconto number ✓ Selling unit price, after discount.
valorTotalVenda number Item total. Used to split freight and expenses.
valorTotalProdutosComDesconto number Same as valorTotalVenda. Required when valorTotalVenda is omitted.

Body:

{
"uniqueIdCliente": "CLI-100",
"codTipoPedido": 2,
"codListaPreco": "101",
"codFilial": "1",
"valorFrete": 0,
"valorDespesasAcessorias": 0,
"descontoDestacado": 0,
"itensPedido": [
{
"codProduto": "65471",
"qtde": 10,
"valorUnitarioSemDesconto": 14.74,
"valorUnitarioComDesconto": 14.74,
"valorTotalProdutosComDesconto": 147.4
}
]
}

Response. The amounts depend on your company’s tax rules:

{
"valorProdutosSemDescAcres": 147.4,
"valorProdutosComDescAcres": 147.4,
"valorFrete": 0,
"valorDespesasAcessorias": 0,
"descontoDestacado": 0,
"valorIPI": 45.8,
"valorICMS_ST": 17.42,
"totalTaxaAdicional": 0,
"valorTotalPedido": 210.62,
"itensPedido": [
{
"codProduto": "65471",
"qtde": 10,
"valorUnitarioComDesconto": 14.74,
"valorTotalProdutosComDesconto": 147.4,
"aliquotaIPI": 5,
"aliquotaICMS": 17,
"aliquotaIcmsSt": 17,
"valorTotalICMSProprio": 17.79,
"valorTotalIPI": 45.8,
"valorTotalICMSST": 17.42,
"valorTaxaAdicional": 0,
"valorUnitarioComImpostos": 21.061759,
"valorTotalComImpostos": 210.62
}
]
}

The tax and the order totals come back with 2 decimal places. valorUnitarioComImpostos may have more decimal places.

If the customer, the order type or the price list does not exist, the response is 404 with { "erro": "..." }. Invalid JSON or a missing required field responds 422 with { "erro": "..." }.