Skip to main content

Resync Sales Order Totals

POST 

/api/sales-orders/:salesOrder/resync-totals

Put a sales channel order's saved tax total back in step with the channel tax on its lines. Use it when an order's saved tax drifted from its lines (for example by per-line rounding), which also stops its configured lines from moving off the base product (block code stale_tax with fix repair_totals).

Required scope: orders:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Authentication: Requires Bearer token (scope orders:write) and permission to update sales orders.

No body. Writes only when it is safe: a per-line rounding gap, or any gap on a Shopify order whose stored line items carry exactly the tax its lines do. It never writes an order inside the accounting lock date, one with a posted journal entry, or one whose payments would stop matching the repaired total. Running it again on a repaired order returns in_step.

Response data: sales_order_id, status, repaired (true only for repaired), saved_tax_total (the saved tax before the repair), lines_tax_total (the tax on the lines, which the order now carries when repaired) and message.

Returns 200 with status: repaired when it wrote the new total. Otherwise returns 422 with the same fields and status:

  • in_step — "Order totals are already in step with its lines."
  • not_channel — SKU.io works out this order's tax itself, so there is nothing to re-sync.
  • needs_channel_resync — the gap is more than rounding; re-sync the order from its sales channel.
  • locked — the order is inside the accounting lock date.
  • posted — the order has a posted journal entry.
  • payments_disagree — the order's payments would no longer match its total.

Returns 404 when the sales order does not exist.

zero_tax_not_honoured (422): the channel charged no tax, but the order still carries SKU tax rates that its total would add back. Clear the tax rates on the order, then try again.

Request​

Responses​

OK

Response Headers
    Content-Type