Skip to main content
POST /v1/transactions calculates tax for a sale. Send product amounts before tax, the applicable date, and the customer address used for the calculation.

Money and quantities

All monetary fields use integer minor units. Apply the currency’s scale before sending the request. Use JSON numbers greater than zero for quantity; fractional quantities are supported. Send currency as a supported three-letter code. Responses normalize the code to lowercase. Zero quantities and unsupported currency codes return HTTP 400 invalid_input.

Discounts

Each line’s amount is already discounted:
For two items priced at USD 10.00 each with a USD 2.00 discount, send:
The API uses the supplied amount as the calculation base. It does not recompute it from quantity and unit price or subtract the discount again. total_discount reports the sum of product discounts; those discounts are already reflected in the totals.

Product codes

Send each line’s product_code as it appears in your product catalogue in the Yonda portal. Leading and trailing whitespace is ignored on both your code and the catalogue’s, and so is case: ABC-123, abc-123 and Abc-123 find the same product. Each line is priced under:
  1. the tax category your organization chose for that product, or
  2. your organization’s default category, when the product has no category, isn’t in your catalogue, or the line has no product_code, or
  3. general goods, when you have no default.
A product code never makes a calculation fail. Each response line reports the category it was priced under in classification, with source set to product, default or general. A line is also priced as general goods if your catalogue cannot be read in time, or if one of its categories cannot be priced; in that case every line in the request is priced as general goods. classification is null when no category applied, as when tax is not collected for the address. If your catalogue holds two products whose codes match alike, such as abc-123 and ABC-123, neither is used, even for an exact match, and the line takes your default.

Shipping

Include a shipping object to calculate tax on a delivery charge alongside the products:
Send the shipping cost before tax. Shipping uses the selected customer tax address. Omit shipping when there is no delivery charge. The response then has shipping: null and total_shipping_tax: 0.

Reconcile the response

Treat absent shipping as zero when reconciling these totals:
The quickstart example response uses minor units: 1307 = 1200 + 107, 1307 = 1089 + 218, and 107 = 89 + 18.
Do not add total_shipping_tax to total_tax again. Do not subtract total_discount from the returned totals again.
Each product’s tax_details.jurisdictions and the shipping jurisdictions describe the individual authorities. A rate of 8.75 means 8.75%. Jurisdiction taxable amounts can overlap when multiple authorities tax the same purchase; sum their tax_due values to reconcile tax, not their taxable bases.

Customer address

Set customer.address_source to billing or shipping and provide the corresponding customer address. The selected address is echoed in address_used_for_tax. Include enough address detail for the jurisdiction. Confirm geographic coverage and product treatment with Yonda during onboarding. Use the API reference for field constraints and errors for rejected requests.