Use this endpoint to cancel an entire order. After an order is cancelled, order.hasCancellations=true and each order item will have orderItem.cancelled=true. Orders cannot be uncancelled afterwards. Any order can be cancelled, including flagged orders and unposted orders, as long as the order is not already fully cancelled or fully fulfilled. Partially fulfilled orders can only be cancelled if unfulfilledOnly=true is sent.
When unfulfilledOnly=true is sent, order items that have already been fulfilled are not cancelled, and all unfulfilled order items are cancelled. If the order had no fulfillments, this endpoint behaves the same as when omitting the unfulfilledOnly flag. If the order had at least one fulfillment, then in addition to setting the cancelled status, order.shipped will be set to true and the order is now considered fully fulfilled. If an order item has been partially - but not completely - fulfilled, then that order item will be cancelled and a new uncancelled order item will be created representing the quantity that had already been fulfilled.