API reference · Callbacks and Webhooks
Tax Calculation Request
Description
This is a complete example of the request that CWS will send to your Tax Calculation endpoint.
CWS sends one request per selling company in the order, with your store's access token in the Authorization header and in the token field of the body.
Your endpoint responds with the calculation. The response body must follow the format documented in Expected response: the same field names, the same types and the same structure as the example.
The calculation is only accepted when the response has status: "ok". With any other value, CWS treats the calculation as an error and records the response's mensagem as the reason.
Parameters
Headers
| Field | Type | Description |
|---|---|---|
| Authorization | string | Your store's access token, in the |
| tenantId | string | Sent only when set up in your store's tax calculation integration. The header name and value are the ones agreed with your store. |
Payload
| Field | Type | Description |
|---|---|---|
| cliente | string | CPF or CNPJ of the order's customer. |
| empresa | string | Document of the company that sells the items. Each company in the order gets its own request. |
| finalidade | integer | Code of the purpose ( |
| itens | array of object | The company's items in the order. Fields in itens[] |
| num_pedido | string | Always |
| token | string | Your store's access token, the same as the |
| uf | string | State (UF) of the first address given for the calculation. |
| valor_frete | number | Freight value of the company's items. |
| valor_pedido | number | Sum of sale price × quantity of the company's items, without the freight. |
| Field | Type | Description |
|---|---|---|
| item | string | Item identifier in the cart. |
| partner_part_code | string | Internal product code ( |
| pre_unit | string | Unit sale price, as text with 2 decimal places (e.g.: |
| qtde | integer | Item quantity. |
{
"cliente": "57.578.030/0001-05",
"empresa": "30.424.972/0001-74",
"finalidade": 4,
"itens": [
{
"item": "123456",
"partner_part_code": "FO0002248281",
"pre_unit": "451.99",
"qtde": 45
},
{
"item": "7891011",
"partner_part_code": "FO0002248279",
"pre_unit": "654.99",
"qtde": 5
}
],
"num_pedido": "0",
"token": "SEU_TOKEN_GERADO",
"uf": "ES",
"valor_frete": 0,
"valor_pedido": 23614.5
}Expected response
{
"empresa": "30.424.972/0001-74",
"num_pedido": "0",
"cliente": "57.578.030/0001-05",
"mensagem": "sucesso",
"status": "ok",
"itens": [
{
"item": "123456",
"st": "0.000000",
"ipi": "11.120000",
"icms": 0,
"pis": 0,
"cofins": 0
},
{
"item": "7891011",
"st": "0.000000",
"ipi": "0.000000",
"icms": 0,
"pis": 0,
"cofins": 0
}
]
}