> The index of all pages is at [llms.txt](https://developers.qliro.com/llms.txt). Add `.md` to any page URL for its Markdown.

# Cancel order (/api-reference/admin/orders/cancel-order)

`POST https://payments.qliro.com/checkout/adminapi/v2/cancelOrder`

Production: `https://payments.qliro.com/checkout/adminapi`. Staging: `https://pago.qit.nu/checkout/adminapi`

Cancels an order that still has a reserved amount and items not marked as shipped. Cancelling an order paid with the `TRUSTLY` payment method also creates a refund transaction.

The response only confirms that Qliro received the request. Qliro sends the result in a notification with the `PaymentTransactionId`.

## Body (application/json)

- `RequestId` (string): A GUID formatted string used to avoid the same request being executed multiple times. The GUID will be stored for 7 days, and during that time, any requests sent with the same GUID will be denied. https://guidgenerator.com/online-guid-generator.aspx. Format: `guid`
- `MerchantApiKey` (string, required): Will be provided by Qliro Checkout when setting up merchant account. Length: `0 <= x <= 50`
- `OrderId` (integer): The Qliro Checkout order ID. Format: `int64`

## Responses

### 200 (application/json)

Request received.

- `PaymentTransactions` (object[] | null)
  - `PaymentTransactionId` (integer): Format: `int64`
  - `Status` (InfrastructureConstantsPaymentTransactionStatus): Values: `0`, `1`, `2`, `3`, `4`, `5`, `6`

Example:

```json
{
  "PaymentTransactions": [
    {
      "PaymentTransactionId": 0,
      "Status": 0
    }
  ]
}
```

### 400 (application/json)

- `ErrorCode` (string | null): Unique error code
- `ErrorMessage` (string | null): Detailed error message
- `ErrorReference` (string): A tracking ID from Qliro Checkout. Format: `guid`

Example:

```json
{
  "ErrorCode": "string",
  "ErrorMessage": "string",
  "ErrorReference": "string"
}
```

### 500 (application/json)

- `ErrorCode` (string | null): Unique error code
- `ErrorMessage` (string | null): Detailed error message
- `ErrorReference` (string): A tracking ID from Qliro Checkout. Format: `guid`

Example:

```json
{
  "ErrorCode": "string",
  "ErrorMessage": "string",
  "ErrorReference": "string"
}
```

## Example request

```bash
curl -X POST "https://payments.qliro.com/checkout/adminapi/v2/cancelOrder" \
  -H "Content-Type: application/json" \
  -d '{
  "MerchantApiKey": "HATS"
}'
```
