Skip to main content

7. Order Cancellation API

API for canceling an order already pushed to GHTK system

Endpoint

In case you want to cancel using GHTK's tracking order.

POST /services/shipment/cancel/{TRACKING_ORDER}
warning

When using the partner code (the order.id code passed during order submission), please adhere to the following format:

  • TRACKING_ORDER = partner_id:PARTNER_CODE
POST /services/shipment/cancel/partner_id:{PARTNER_CODE}

Headers

  • Token: {API_TOKEN}
  • X-Client-Source: {PARTNER_CODE}
  • Content-Type: application/json

Parameters

ParameterMandatoryDesc
TRACKING_ORDERYesGHTK's reference ID or the Partner's reference ID (submitted with the order.id field in the "Submit an Order" API).

Code

GET /services/shipment/cancel/{TRACKING_ORDER} HTTP/1.1
Token: {API_TOKEN}
X-Client-Source: {PARTNER_CODE}

Response

Cancel successfully

{
"success": true,
"message": "",
"log_id": "..."
}

Cancelled order

{
"success": false,
"message": "Đơn hàng đã đã ở trạng thái hủy",
"log_id": "..."
}

Cases Where Order Cancellation Is Not Possible

danger

Orders cannot be canceled after they have been successfully picked up. The API can only cancel orders in the following states:

  • Created (1 & 2)
  • Picking (12)
{
"success": false,
"message": "Đơn đã lấy hàng, không thể hủy đơn.",
"log_id": "..."
}