Skip to main content
POST
Calculate transaction tax
Calculate tax at checkout using your customer’s selected billing or shipping address. The response includes item-level tax, jurisdiction details, and a separate shipping breakdown when you provide a delivery charge. For a complete request, start with the quickstart. See the calculation guide for minor units, discounts, and shipping totals.

Authorizations

Authorization
string
header
required

Your Yonda API key, sent as Authorization: Bearer <key>.

Body

application/json

Calculate item and shipping tax for a sale. Send amounts before tax.

transaction_date
string<date-time>
required

ISO 8601 date-time whose calendar date as sent selects the rates, without timezone conversion.

currency
string
required

Three-letter currency code such as usd, case-insensitive and returned lowercase. A code not supported for calculation returns HTTP 400 invalid_input.

Required string length: 3
customer
Customer · object
required

Customer details and the address selection for tax.

line_items
LineItem · object[]
required

Product lines to calculate, each with a unique number.

Required array length: 1 - 1250 elements
transaction_type
enum<string>
default:sale

Type of transaction to calculate.

Available options:
sale
reference_id
string | null

Your transaction reference, echoed in the response.

Maximum string length: 80
shipping
Shipping · object | null

Optional delivery charge to calculate with the products.

Response

Successful Response

Sale calculation. subtotal includes products and shipping after discounts, before tax. total_tax includes product and shipping tax. amount_total = subtotal + total_tax. total_shipping_tax is already included in total_tax.

transaction_type
enum<string>
required

Transaction type, echoed from the request.

Available options:
sale
transaction_date
string<date-time>
required

Transaction date-time echoed in ISO 8601 format.

currency
string
required

Currency from the request, returned lowercase.

customer
CustomerDetails · object
required

Customer details echoed from the request.

address_used_for_tax
AddressUsedForTax · object
required

Selected customer address and its tax sourcing.

line_items
ResponseLineItem · object[]
required

Product lines with calculated tax and totals.

Minimum array length: 1
subtotal
integer
required

Products and shipping after discounts, before tax, in non-negative integer minor units.

Required range: x >= 0
total_discount
integer
required

Sum of product line discounts in non-negative integer minor units.

Required range: x >= 0
total_tax
integer
required

All product and shipping tax in non-negative integer minor units, including total_shipping_tax.

Required range: x >= 0
total_shipping_tax
integer
required

Shipping tax in non-negative integer minor units, already included in total_tax.

Required range: x >= 0
amount_total
integer
required

Total including tax in non-negative integer minor units, equal to subtotal + total_tax.

Required range: x >= 0
reference_id
string | null

Your transaction reference, echoed from the request.

shipping
ShippingTaxDetail · object | null

Delivery charge with calculated tax, or null when shipping was omitted.