Cart Tax Calculation
Calculate sales tax for a cart of items on behalf of a TaxCloud-connected merchant.
Calculate the tax due on a cart of items for one of your TaxCloud-connected merchants. Use this before you record an order so you can display an accurate tax total at checkout. The calculation reflects the merchant’s own compliance configuration (registrations and product rules), and applies the customer’s exemption certificates when you ask it to.
This is the merchant-scoped cart calculation at /merchant/cart/calculate.
It is different from the general-purpose /calculate/cart rate-lookup endpoint,
which is not tied to a merchant.
For how cart calculations count toward billable API calls, see Pricing & Billing.
One endpoint, two engines
/merchant/cart/calculate serves both compliance models.
The request body is the same for both, and Ziptax picks the engine from the
merchantId you send — you never branch on merchant type when building a
request.
If you serve both merchant types, read Self-Managed Cart Calculation before you reuse this page’s payloads. Taxability codes mean different things on the two paths, and a TaxCloud shipping code sent for a self-managed merchant is taxed as an ordinary product rather than as freight.
The rest of this page describes the TaxCloud-connected path. A connected
merchant with no valid credentials returns 404 (credentials not found) —
Ziptax does not fall back to its own engine, because the resulting tax would not
match what the merchant’s TaxCloud account files.
Endpoint
Request body
Cart object
Address object
Line item object
Discounts object
For percentage discounts, value is a decimal fraction between 0 and 1
(0.1 = 10% off); for amount discounts it is a fixed currency amount. When
you provide discounts, line-item prices must be pre-discount originals — if
your prices are already discounted, omit the discounts field.
Example
Response
Returns the calculated carts with tax computed per line item.
If you do not receive a response, it is safe to call cart/calculate again:
calculation has no lasting side effect. Do not, however, retry
order or refund writes blindly. See
Retries and idempotency.
Exemptions
Add an exemption object to a cart to apply one of the customer’s
exemption certificates:
Ziptax checks the certificate against the destination state you send, using
the calendar day in transactionDate’s own offset or today in UTC if omitted.
For a Ziptax exemption, TaxCloud receives no certificate ID and records
“Exempt, no certificate”.
If TaxCloud returns the cart as exempt, the exemption object includes the
applied Ziptax certificate.
A cart forwarded unchanged returns TaxCloud’s response as-is. When the
Ziptax certificate store is disabled, carts are forwarded unchanged. A store
read failure returns 503 before forwarding. Creating the order with
order/create-from-cart records the cart
as calculated, exemption included. See Exempt a Sale for the
full matching rules.