Calculate Cart Tax

<span class="plan-badge plan-badge--pro">Available on Pro and Enterprise Plans</span> Calculates sales tax per line item for one or more carts. The request body is the same for every merchant, and Ziptax routes on the merchant's compliance model. For a **TaxCloud-connected merchant**, the cart is forwarded to TaxCloud (POST /connections/{connectionId}/carts) using the merchant's stored credentials, and TaxCloud's response is returned verbatim. Additional cart fields (items, transactionDate, destination, ...) are relayed unchanged. Requires an Enterprise plan and credentials on file; a connected merchant without valid credentials returns 404. For a **self-managed merchant** (status external_compliance), Ziptax calculates the tax in-process with its own rate engine and no TaxCloud call. Three differences matter on that path. (1) Calculation only: nothing is persisted, connectionId is omitted from the response, and the returned cartId is a correlation token that cannot be passed to /merchant/order/create-from-cart. (2) tic uses the Ziptax taxability code vocabulary, not TaxCloud's: 10001 is shipping and 11000 is handling, while TaxCloud's shipping codes (11010-11015) and the Colorado retail delivery fee code (11098) carry no special meaning and are taxed as ordinary product codes. (3) discounts, exemption, and deliveredBySeller are rejected with 400 rather than ignored, non-USD currency and countryCode CA are rejected, and a cart is capped at 250 line items. Every other merchant transaction endpoint returns 403 for a self-managed merchant. See the Self-Managed Cart Calculation guide for the full contract.

Authentication

X-API-KEYstring
API Key authentication via header

Request

This endpoint expects an object.
itemslist of objectsRequired

The carts to calculate tax for. Most integrations send a single cart; up to 100 carts may be calculated in one call.

merchantIdstringRequired
UUID of the merchant whose TaxCloud connection is used. Must be owned by the calling account. Consumed by the Ziptax layer for routing and not forwarded to TaxCloud.
transactionDatedatetimeOptional
RFC3339 datetime the carts are calculated for. Defaults to the current time when omitted.

Response

TaxCloud response relayed verbatim.
connectionIdstring
The TaxCloud connection the calculation ran under.
itemslist of objectsOptional

One calculated cart per submitted cart, in the same order, with per-line-item tax rates and amounts.

transactionDatedatetimeOptional
RFC3339 datetime the carts were calculated for.

Errors

400
Merchant Cart Calculate Body Bad Request Error
401
Merchant Cart Calculate Body Unauthorized Error
403
Merchant Cart Calculate Body Forbidden Error
404
Merchant Cart Calculate Body Not Found Error
413
Merchant Cart Calculate Body Content Too Large Error
422
Merchant Cart Calculate Body Unprocessable Entity Error
429
Merchant Cart Calculate Body Too Many Requests Error
500
Merchant Cart Calculate Body Internal Server Error
502
Merchant Cart Calculate Body Bad Gateway Error
504
Merchant Cart Calculate Body Gateway Timeout Error