The calculation
object contains tax rate information. A calculation also includes a calculation_id
that you’ll use to record a transaction
for filing.
When to create Calculations
Calculations should be used any time you need to calculate sales tax before charging a customer for a transaction. Most e-commerce clients will submit a POST
to /tax/calculations
during their checkout flow after the end customer has submitted their address, but before collecting payment.
How to create Calculations
curl --request POST \
--url https://api.numeralhq.com/tax/calculations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"customer": {
"address": {
"address_line_1": "3990 N County Rd 300 E",
"address_city": "Danville",
"address_province": "IN",
"address_postal_code": "46122",
"address_country": "US",
"address_type": "shipping"
}
},
"order_details": {
"customer_currency_code": "USD",
"tax_included_in_amount": false,
"line_items": [
{
"reference_line_item_id": "line_123456789",
"product_category": "GENERAL_MERCHANDISE",
"amount": 200,
"quantity": 2
}
]
}
}'
{
"calculation_id" : "calc_17364047950082c1fd8f0-f763-40f8-8c02-e8fc9ded0944" ,
"object" : "tax.calculation" ,
"line_items" : [
{
"line_item_id" : "line_987654321" ,
"reference_product_id" : "temp-a4a427d4-42fc-47f1-9092-c74f935438a3" ,
"reference_product_name" : "temp-a4a427d4-42fc-47f1-9092-c74f935438a3" ,
"product_tax_code" : "GENERAL_MERCHANDISE" ,
"tax_included_in_amount" : true ,
"tax_jurisdictions" : [
{
"tax_rate" : 0.07 ,
"rate_type" : "REDUCED_RATE" ,
"jurisdiction_name" : "State"
}
],
"tax_amount" : 14 ,
"amount_excluding_tax" : 200 ,
"amount_including_tax" : 214
}
],
"total_tax_amount" : 14 ,
"total_amount_excluding_tax" : 200 ,
"expires_at" : 1714787673 ,
"testmode" : "false"
}
We return both the aggregate tax information as well as a detailed breakdown for each line item. Many users will just use the total_tax_amount
to identify what to charge a user, but you will always have the details as you need them.
Further documentation
The full documentation for creating calculations is on this page .