> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.taxwire.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancellations

> Cancel an order before it ships, or undo a sale recorded by mistake

A cancellation here means the order, or part of it, is called off before it ships. Once an order has shipped, a cancellation or return is a refund: see [Refunds](https://apidocs.taxwire.com/api-reference/flows/refunds.md).

```mermaid theme={null}
flowchart TD
    A{Has the order shipped?} -- no --> B{Whole order or part?}
    B -- whole --> C[No Taxwire call]
    B -- part --> D(["POST /calculations<br/>cancelled lines only"])
    D --> E[Refund the buyer that tax]
    E --> F[Record the rest when it ships]
    A -- yes --> G[It's a refund: record a credit]
    H[Sale recorded by mistake] --> V(["POST /transactions/{id}<br/>status: void"])
    classDef taxwire fill:#e6f0fb,stroke:#006ad4,color:#00336b
    class D,V taxwire
```

## Cancelled before shipping

Nothing was recorded, so there is nothing to undo in Taxwire. Cancelling the whole order needs no call.

To find the tax to refund for a partial cancellation, quote the cancelled lines with `POST /calculations`:

* **Send only the cancelled lines**, each with the same addresses, tax code and discount it had on the order. Don't quote the remaining lines and refund the difference.
* **Set `transaction_date` to the checkout time**, so the rates match what the buyer was charged.
* **If the shipping fee changes**, add the change as an `ANCILLARY.SHIPPING` line.

Refund the buyer the returned `tax_amount`. When the rest of the order ships, record only the lines that shipped, as described in [Checkout and shipment](https://apidocs.taxwire.com/api-reference/flows/checkout.md#3-record-the-sale-when-it-ships).

## Sale recorded by mistake

If you recorded a sale that never happened, void it:

```http theme={null}
POST /transactions/{id}
```

```json theme={null}
{ "status": "void" }
```

Void a sale only while its period hasn't been filed. Once the return for that period is filed, record a [full refund](https://apidocs.taxwire.com/api-reference/flows/refunds.md#full-refund) instead, so the correction lands in the current period. The API doesn't enforce this, so your system needs to.

Use void only for mistakes. A sale that happened and was later refunded is a credit, so that both stay on your returns.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.