Order total calculation
Calculation rules
There are two ways to calculate the total value of an order:
1. Calculation based on product unit_value
If the unit price (unit_value) of each product is provided, the total value will be the sum of all product values.
Example: three products priced at R$ 10.00, R$ 30.00, and R$ 50.00 result in a total of R$ 90.00.
If the purchase is paid in installments, the interest must be calculated on the total product value plus shipping (shipping_value).
Example: products R$ 90.00 + shipping R$ 15.00 = R$ 105.00. With 10% interest over 5 installments, the final amount will be R$ 115.50. This adjusted amount must be distributed proportionally across the products.
curl --request POST \
--url https://api.appmax.com.br/v1/orders \
--header 'Authorization: Bearer YOUR_TOKEN' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"customer_id": 113543689,
"discount_value": 0,
"shipping_value": 1500,
"products": [
{
"sku": "46_0",
"name": "PRODUCT_TEST_1",
"quantity": 1,
"unit_value": 1350
},
{
"sku": "47_0",
"name": "PRODUCT_TEST_2",
"quantity": 1,
"unit_value": 3350
},
{
"sku": "48_0",
"name": "PRODUCT_TEST_3",
"quantity": 1,
"unit_value": 5350
}
]
}'2. Calculation based on products_value with interest
If the unit_value of each product is not provided, you must pass the total product value (products_value) with interest and shipping already calculated.
Example: products + shipping = R$ 105.00. With 10% interest, the final amount will be R$ 115.50. This value must be sent directly in products_value.
curl --request POST \
--url https://api.appmax.com.br/v1/orders \
--header 'Authorization: Bearer YOUR_TOKEN' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"customer_id": 113543689,
"products_value": 10050,
"discount_value": 0,
"shipping_value": 1500,
"products": [
{
"sku": "46_0",
"name": "PRODUCT_TEST_1",
"quantity": 1
},
{
"sku": "47_0",
"name": "PRODUCT_TEST_2",
"quantity": 1
},
{
"sku": "48_0",
"name": "PRODUCT_TEST_3",
"quantity": 1
}
]
}'General rules
WARNING
- Always send the calculation with interest included, whether in each product's individual value or in the total product value plus shipping.
- The system does not calculate interest automatically. The submitted value must already be adjusted according to the payment method, applicable interest, and shipping.
To look up installment values with the rates configured in Appmax, use the Installment calculation endpoint.