# Hủy đơn hàng

* Tính năng này dùng để hủy vận chuyển của đơn hàng

## Request

* Xem [common request params](/v3/readme.md#request-params).
* Xem [Postman sample](https://www.postman.com/nhanh-vn/pos-open-nhanh-vn/request/yix7eqv/order-edit).

```curl
curl --location --globoff 'https://pos.open.nhanh.vn/v3.0/order/cancelcarrier?appId={{appId}}&businessId={{businessId}}' \
--header 'Authorization: {{accessToken}}' \
--header 'Content-Type: application/json' \
--data '{
    "orderId": 14905641
}'
```

## Params

| Key     | Type  | Description |
| ------- | ----- | ----------- |
| orderId | array | ID đơn hàng |

## Response

* Xem cấu trúc chung [tại đây](/v3/readme.md#response).

### Failed response

* Xem các mã lỗi chung [tại đây](/v3/readme.md#failed-response).
* Danh sách **errorCode** của riêng API này:

| errorCode                            | Description                              |
| ------------------------------------ | ---------------------------------------- |
| ERR\_ORDER\_CARRIER\_NOT\_YET\_SENT  | Đơn hàng chưa gửi sang hãng vận chuyển   |
| ERR\_ORDER\_CARRIER\_NO\_API\_CANCEL | Hãng vận chuyển không hỗ trợ API hủy đơn |
| ERR\_ORDER\_CARRIER\_REJECT          | Gọi API hủy đơn hãng vận chuyển báo lỗi. |

### Successful response

```json
  {
      "code": 1,
      "data": {}
  }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://apidocs.nhanh.vn/v3/order/cancelcarrier.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
