Cancel Order
Cancel an order created through the Ahamove Order ID or the Tracking Number
Can cancel an order which has one of statuses below
IDLE
,ASSIGNING
,ACCEPTED
,CONFIRMING
,PAYING
comment
parameters have been standardized by Ahamove at Cancel Reason. Partners only need to use the reasons for User, thecomment
corresponding to the En or Vi column when Partners needs to cancel the order
Cancel Order By Ahamove Order ID
- cURL
- JavaScript
curl --location --request DELETE 'https://partner-apistg.ahamove.com/v3/orders/<order_id>' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
"comment": "Khách hàng muốn hủy đơn"
}'
const myHeaders = new Headers();
myHeaders.append('Content-Type', 'application/json');
myHeaders.append('Authorization', 'Bearer <token>');
const raw = JSON.stringify({
comment: 'Khách hàng muốn hủy đơn',
});
const requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow',
};
fetch('https://partner-apistg.ahamove.com/v3/orders/<order_id>', requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
HTTP Request
DELETE https://partner-apistg.ahamove.com/v3/orders/<order_id>
Headers
Parameter | Value | Required | Description |
---|---|---|---|
Content-Type | application/json | Yes | |
Authorization | Bearer <token> | Yes | Token of the order creator |
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
order_id | String | Yes | Order ID of the order to cancel |
comment | String | Yes | Reason for cancellation (Required in ACCEPTED status) |
Cancel Order By Order Tracking number
For 1-N orders (1 pickup point - N delivery points), when the Partner cancels the order using the tracking number of the delivery point, the Order ID containing the delivery points will also be canceled.
- cURL
- JavaScript
curl --location --request DELETE 'https://partner-apistg.ahamove.com/v3/orders/tracks' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
"tracking_number": "HD00001",
"comment": "Khách hàng muốn hủy đơn"
}'
const myHeaders = new Headers();
myHeaders.append('Content-Type', 'application/json');
myHeaders.append('Authorization', 'Bearer <token>');
const raw = JSON.stringify({
tracking_number: 'HD00001',
comment: 'Khách hàng muốn hủy đơn',
});
const requestOptions = {
method: 'DELETE',
headers: myHeaders,
redirect: 'follow',
};
fetch('https://partner-apistg.ahamove.com/v3/orders/tracks', requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
HTTP Request
DELETE https://partner-apistg.ahamove.com/v3/orders/tracks
Headers
Parameter | Value | Required | Description |
---|---|---|---|
Content-Type | application/json | Yes | |
Authorization | Bearer <token> | Yes | Token of the order creator |
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
tracking_number | String | Yes | Tracking number (in path[x]) of the order to cancel |
comment | String | Yes | Reason for cancellation (Required in ACCEPTED status) |
Response
JSON response example:
{}
Status-Code: 200 OK
Errors
Code | Text | Description |
---|---|---|
401 | NOT_AUTHORIZED | No permission to cancel the order |
404 | ORDER_NOT_FOUND | Order ID not found |
406 | INVALID_ORDER_STATUS | Invalid order status for cancellation |
500 | INTERNAL_SERVER_ERROR | We had a problem with our server. Try again later |
503 | SERVICE_UNAVAILABLE | We're temporarily offline for maintenance. Please try again later |