confirmCancelOrder mutation

The confirmCancelOrder mutation allows a guest shopper to cancel an order by passing its encoded identifier and a confirmation key.

A guest can cancel an order only if the following conditions are true:

If the guest customer has been charged for the order, the order is placed in the CLOSED state, and the user will be issued a refund. Otherwise, the status of the order is set to CANCELED.

The mutation returns an error if the order cannot be cancelled.

Syntax

mutation: { confirmCancelOrder(input: ConfirmCancelOrderInput!) {CancelOrderOutput}}

Reference

The confirmCancelOrder reference provides detailed information about the types and fields defined in this mutation.

Example usage

The following example cancels order ID Nzg= and includes the confirmation key.

Request:

mutation {
    confirmCancelOrder(
        input: {
            order_id: "Nzg=",
            confirmation_key: "z4ge1luFSkEes7VIO2aUa832LmGWNmu8"
        }
    ){
        error
        errorV2 {
            code
            message
        }
        order {
            status
        }
    }
}

Response:

{
  "data": {
    "confirmCancelOrder": {
      "error": null,
      "errorV2": null,
      "order": {
        "status": "Canceled"
      }
    }
  }
}