Estimate Order Fee
Estimate order fees for one or multiple services simultaneously
Estimate order fees using service_id
and requests
- cURL
- JavaScript
curl --location 'https://partner-apistg.ahamove.com/v3/orders/estimates' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
"order_time": 0,
"path": [
{
"lat": 10.76975346,
"lng": 106.6636615,
"address": "7/28 Thành Thái, Phường 14, Quận 10, Thành phố Hồ Chí Minh",
"short_address": "Thành Thái, Quận 10",
"name": "Lan",
"mobile": "84944309348",
"remarks": "Đến nơi lấy hàng đọc mã đơn để nhận hàng"
},
{
"lat": 10.8018493,
"lng": 106.714466,
"address": "475A Điện Biên Phủ, Phường 25, Bình Thạnh, Thành phố Hồ Chí Minh",
"short_address": "Đại Học Hutech, Quận Bình Thạnh, Hồ Chí Minh",
"name": "Anh",
"mobile": "0912345678",
"cod": 100000,
"item_value": 250000,
"tracking_number": "ABCD1234",
"remarks": "Gọi điện trước khi giao. Giao hàng cẩn thận"
}
],
"services": [
{
"_id": "SGN-BIKE",
"requests": [
{
"_id": "SGN-BIKE-TIP",
"num": 1
},
{
"_id": "SGN-BIKE-BULKY",
"tier_code": "TIER_2"
}
]
},
{
"_id": "SGN-ECO",
"requests": []
},
{
"_id": "SGN-TRUCK-1000",
"requests": []
},
{
"_id": "VNM-PARTNER-AHAMOVE",
"requests": [
{
"_id": "VNM-PARTNER-AHAMOVE-DONG-KIEM",
"num": 1
}
]
}
],
"payment_method": "CASH",
"remarks": "Ghi chú đơn hàng",
"promo_code" : "AHMKM",
"items": [
{
"_id": "TG",
"num": 1,
"name": "Tủ gỗ nhỏ",
"price": 450000
},
{
"_id": "GDB",
"num": 2,
"name": "Gương để bàn",
"price": 120000
}
],
"package_detail": [
{
"weight": 10,
"length": 1.2,
"width": 0.8,
"height": 2.0,
"description": "Nội thất"
}
]
}'
const myHeaders = new Headers();
myHeaders.append('Content-Type', 'application/json');
myHeaders.append('Authorization', 'Bearer <token>');
const raw = JSON.stringify({
order_time: 0,
path: [
{
lat: 10.76975346,
lng: 106.6636615,
address: '7/28 Thành Thái, Phường 14, Quận 10, Thành phố Hồ Chí Minh',
short_address: 'Thành Thái, Quận 10',
name: 'Lan',
mobile: '84944309348',
remarks: 'Đến nơi lấy hàng đọc mã đơn để nhận hàng',
},
{
lat: 10.8018493,
lng: 106.714466,
address:
'475A Điện Biên Phủ, Phường 25, Bình Thạnh, Thành phố Hồ Chí Minh',
short_address: 'Đại Học Hutech, Quận Bình Thạnh, Hồ Chí Minh',
name: 'Anh',
mobile: '0912345678',
cod: 100000,
item_value: 250000,
tracking_number: 'ABCD1234',
remarks: 'Gọi điện trước khi giao. Giao hàng cẩn thận',
},
],
services: [
{
_id: 'SGN-BIKE',
requests: [
{
_id: 'SGN-BIKE-TIP',
num: 1,
},
{
_id: 'SGN-BIKE-BULKY',
tier_code: 'TIER_2',
},
],
},
{
_id: 'SGN-ECO',
requests: [],
},
{
_id: 'SGN-TRUCK-1000',
requests: [],
},
{
_id: 'VNM-PARTNER-AHAMOVE',
requests: [
{
_id: 'VNM-PARTNER-AHAMOVE-DONG-KIEM',
num: 1,
},
],
},
],
payment_method: 'CASH',
remarks: 'Ghi chú đơn hàng',
promo_code: 'AHMKM',
items: [
{
_id: 'TG',
num: 1,
name: 'Tủ gỗ nhỏ',
price: 450000,
},
{
_id: 'GDB',
num: 2,
name: 'Gương để bàn',
price: 120000,
},
],
package_detail: [
{
weight: 10,
length: 1.2,
width: 0.8,
height: 2,
description: 'Nội thất',
},
],
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow',
};
fetch('https://partner-apistg.ahamove.com/v3/orders/estimates', requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
Estimate order fees using group_service_id
and group_requests
Ahamove will automatically determine the service_id
based on the pickup address location and group_service_id
- cURL
- JavaScript
curl --location 'https://partner-apistg.ahamove.com/v3/orders/estimates' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
"order_time": 0,
"path": [
{
"lat": 10.76975346,
"lng": 106.6636615,
"address": "7/28 Thành Thái, Phường 14, Quận 10, Thành phố Hồ Chí Minh",
"short_address": "Thành Thái, Quận 10",
"name": "Lan",
"mobile": "84944309348",
"remarks": "Đến nơi lấy hàng đọc mã đơn để nhận hàng"
},
{
"lat": 10.8018493,
"lng": 106.714466,
"address": "475A Điện Biên Phủ, Phường 25, Bình Thạnh, Thành phố Hồ Chí Minh",
"short_address": "Đại Học Hutech, Quận Bình Thạnh, Hồ Chí Minh",
"name": "Anh",
"mobile": "0912345678",
"cod": 100000,
"item_value": 250000,
"tracking_number": "ABCD1234",
"remarks": "Gọi điện trước khi giao. Giao hàng cẩn thận"
}
],
"group_services": [
{
"_id": "BIKE",
"group_requests": [
{
"_id": "TIP",
"num": 1
},
{
"_id": "BULKY",
"tier_code": "TIER_2"
}
]
},
{
"_id": "ECO",
"group_requests": []
},
{
"_id": "TRUCK-2000",
"group_requests": []
},
{
"_id": "VNM-PARTNER-AHAMOVE",
"group_requests": [
{
"_id": "DONG-KIEM",
"num": 1
}
]
}
],
"payment_method": "CASH",
"remarks": "Ghi chú đơn hàng",
"promo_code" : "AHMKM",
"items": [
{
"_id": "TG",
"num": 1,
"name": "Tủ gỗ nhỏ",
"price": 450000
},
{
"_id": "GDB",
"num": 2,
"name": "Gương để bàn",
"price": 120000
}
],
"package_detail": [
{
"weight": 10,
"length": 1.2,
"width": 0.8,
"height": 2.0,
"description": "Nội thất"
}
]
}'
const myHeaders = new Headers();
myHeaders.append('Content-Type', 'application/json');
myHeaders.append('Authorization', 'Bearer <token>');
const raw = JSON.stringify({
order_time: 0,
path: [
{
lat: 10.76975346,
lng: 106.6636615,
address: '7/28 Thành Thái, Phường 14, Quận 10, Thành phố Hồ Chí Minh',
short_address: 'Thành Thái, Quận 10',
name: 'Lan',
mobile: '84944309348',
remarks: 'Đến nơi lấy hàng đọc mã đơn để nhận hàng',
},
{
lat: 10.8018493,
lng: 106.714466,
address:
'475A Điện Biên Phủ, Phường 25, Bình Thạnh, Thành phố Hồ Chí Minh',
short_address: 'Đại Học Hutech, Quận Bình Thạnh, Hồ Chí Minh',
name: 'Anh',
mobile: '0912345678',
cod: 100000,
item_value: 250000,
tracking_number: 'ABCD1234',
remarks: 'Gọi điện trước khi giao. Giao hàng cẩn thận',
},
],
group_services: [
{
_id: 'BIKE',
group_requests: [
{
_id: 'TIP',
num: 1,
},
{
_id: 'BULKY',
tier_code: 'TIER_2',
},
],
},
{
_id: 'ECO',
group_requests: [],
},
{
_id: 'TRUCK-2000',
group_requests: [],
},
{
_id: 'VNM-PARTNER-AHAMOVE',
group_requests: [
{
_id: 'DONG-KIEM',
num: 1,
},
],
},
],
payment_method: 'CASH',
remarks: 'Ghi chú đơn hàng',
promo_code: 'AHMKM',
items: [
{
_id: 'TG',
num: 1,
name: 'Tủ gỗ nhỏ',
price: 450000,
},
{
_id: 'GDB',
num: 2,
name: 'Gương để bàn',
price: 120000,
},
],
package_detail: [
{
weight: 10,
length: 1.2,
width: 0.8,
height: 2,
description: 'Nội thất',
},
],
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow',
};
fetch('https://partner-apistg.ahamove.com/v3/orders/estimates', requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
HTTP Request
POST https://partner-apistg.ahamove.com/v3/orders/estimates
Headers
Parameter | Value | Required | Description |
---|---|---|---|
Content-Type | application/json | Yes | |
Authorization | Bearer <token> | Yes | Token of the order creator |
Body
{
"order_time": 0,
"path": [
{
"lat": 10.76975346,
"lng": 106.6636615,
"address": "7/28 Thành Thái, Phường 14, Quận 10, Thành phố Hồ Chí Minh",
"short_address": "Thành Thái, Quận 10",
"name": "Lan",
"mobile": "84944309348",
"remarks": "Đến nơi lấy hàng đọc mã đơn để nhận hàng"
},
{
"lat": 10.8018493,
"lng": 106.714466,
"address": "475A Điện Biên Phủ, Phường 25, Bình Thạnh, Thành phố Hồ Chí Minh",
"short_address": "Đại Học Hutech, Quận Bình Thạnh, Hồ Chí Minh",
"name": "Anh",
"mobile": "0912345678",
"cod": 100000,
"item_value": 250000,
"tracking_number": "ABCD1234",
"remarks": "Gọi điện trước khi giao. Giao hàng cẩn thận"
}
],
"services": [
{
"_id": "SGN-BIKE",
"requests": [
{
"_id": "SGN-BIKE-TIP",
"num": 1
},
{
"_id": "SGN-BIKE-BULKY",
"tier_code": "TIER_2"
}
]
},
{
"_id": "SGN-ECO",
"requests": []
},
{
"_id": "SGN-TRUCK-1000",
"requests": []
},
{
"_id": "VNM-PARTNER-AHAMOVE",
"requests": [
{
"_id": "VNM-PARTNER-AHAMOVE-DONG-KIEM",
"num": 1
}
]
}
],
"payment_method": "CASH",
"remarks": "Ghi chú đơn hàng",
"promo_code": "AHMKM",
"items": [
{
"_id": "TG",
"num": 1,
"name": "Tủ gỗ nhỏ",
"price": 450000
},
{
"_id": "GDB",
"num": 2,
"name": "Gương để bàn",
"price": 120000
}
],
"package_detail": [
{
"weight": 10,
"length": 1.2,
"width": 0.8,
"height": 2.0,
"description": "Nội thất"
}
]
}
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
order_time | Float (Unix timestamp) | Yes | Delivery time. For immediate orders, set order_time = 0 . |
path | Array | Yes | List of pickup and delivery points. There must be at least 2 paths (pickup and delivery information). |
services | Array | Yes | List service code of AhaMove (SGN-BIKE, SGN-ECO, ...). |
requests | Array | Yes | List of special requests. |
group_services | Array | Yes | Group service code of AhaMove (BIKE, ECO, TRUCK-500, ...). |
group_requests | Array | Yes | Group codes of special requests (TIP, BULKY, D2D,...) |
payment_method | String | Yes | Payment method for the order: - BALANCE : Paid from the account of the order creator. - CASH : Cash payment by the sender. - CASH_BY_RECIPIENT : Cash payment by the recipient. |
promo_code | String | No | Promo code to discount shipping fee. |
remarks | String | No | Notes for the driver. |
idle_until | Float (Unix timestamp) | No | Schedule for delivery. Set idle_until = order_time (if order_time > 0 ) as the time the order starts looking for a driver. |
items | Array | No | List of goods (if any). |
package_detail | Array | No | Package size specifications. |
route_optimized | Boolean | No | True if the partner wants Ahamove to optimize delivery to save costs (1 pickup point, more than 2 delivery points). |
How to get group_service_id
and group_requests
Structure of service_id
:
services._id = city_id + group_services._id
For SAAS services (VNM-PARTNER-XXXX), the structure is: services._id = group_services._id
Example:
services._id | group_services._id |
---|---|
SGN-BIKE | BIKE |
SGN-ECO | ECO |
SGN-2H | 2H |
SGN-2H-PUBLIC | 2H-PUBLIC |
SGN-SAMEDAY | SAMEDAY |
SGN-TRUCK-500 | TRUCK-500 |
SGN-TRUCK-1000 | TRUCK-1000 |
SGN-VAN-500 | VAN-500 |
VNM-PARTNER-AHAMOVE | VNM-PARTNER-AHAMOVE |
Structure of requests._id
:
requests._id = services._id + group_requests._id
For SAAS services (VNM-PARTNER-XXXX), the structure is: requests._id = group_requests._id
Example:
requests._id | group_requests._id |
---|---|
SGN-BIKE-TIP | TIP |
SGN-BIKE-BULKY | BULKY |
SGN-BIKE-INSURANCE | INSURANCE |
SGN-BIKE-D2D | D2D |
SGN-BIKE-SMS | SMS |
SGN-BIKE-FRAGILE | FRAGILE |
SGN-BIKE-ROUND-TRIP | ROUND-TRIP |
VNM-PARTNER-AHAMOVE-TIP | VNM-PARTNER-AHAMOVE-TIP |
Path
Display from path[0]
to multiple path[x], x > 0
.
Parameter | Type | Required | Description |
---|---|---|---|
address | String | Yes | Pickup and delivery address in the correct format. |
lat | Number | Yes | Latitude of the location (optional but recommended for partners to use). |
lng | Number | Yes | Longitude of the location (optional but recommended for partners to use). |
name | String | Yes | Name of the sender or recipient. |
mobile | String | Yes | Phone number of the sender or recipient. |
tracking_number | String | No | Tracking number of the package (partner's internal order code, not mandatory but Ahamove recommends including this in path[x] ). |
remarks | String | No | Notes for the driver for each pickup and delivery point. |
cod | Int | No | Amount of COD the sender needs to collect from the recipient (only provided at the delivery point). |
item_value | Int64 | No | Actual value of the package, used for insurance purposes. |
Model of requests and group_requests
Key | Type | Required | Description |
---|---|---|---|
_id | String | Yes | ID of the special requests (example: SGN-BIKE-TIP for requests or TIP for group_requests ). |
num | Int | No | Quantity, applicable only for special requests with Group ID as PER_UNIT. |
tier_code | String | No | Size category, applicable only for special requests with Group ID as BULKY. |
Model of items
Key | Type | Required | Description |
---|---|---|---|
_id | Int | Yes | ID of the goods. |
name | String | Yes | Name of the goods. |
price | Int | Yes | Price of the goods. |
num | Int | Yes | Total quantity of the goods. |
Model of package_detail
Key | Type | Required | Description |
---|---|---|---|
weight | Float | Yes | Weight of the package (kg). |
length | Float | No | Length of the package (m). |
width | Float | No | Width of the package (m). |
height | Float | No | Height of the package (m). |
description | String | No | Description of the type of goods. |
Note
lat
and lng
is not required but
address
field in parameters needs to have correct information as shown in the
format below
Ex: 117 Hùng Vương, Phường 4, Quận 5, Thành phố Hồ Chí Minh, Việt Nam
or 117 Hùng Vương, Phường 4, Quận 5, Hồ Chí Minh
Address Requirements for Sending to Ahamove
- Clear address with information segments separated by commas
- Address must be searchable on Google Maps (Google Plus Codes can be used)
- No redundant information in Ward/District/Province sections (for Partners allowing customers to select addresses from a dropdown)
Some types of Invalid Address :
- 658 võ văn kiệt p1 Quận 5 Hồ Chí Minh
- 58 Nghĩa Thục - Phường 5 - Quận 5 - Hồ Chí Minh - Việt Nam
- 22 Bùi Hữu Nghĩa
- 60/62 chiêu anh các
- 930 vo văn Kiệt p5q5
- Có ji e gởi đia chỉ 835/17c trần hung dao p1 q5 tphcm giúp c nha, Phường 01, Quận 5, Thành phố Hồ Chí Minh
- 54 Bạch Vân (Nhà màu xanh cuối hẻm, gọi số 0908999999), Phường 5, Quận 5, TP Hồ Chí Minh
- 189 Trần Tuấn Khải F.5 Q.5 Ngay ngã 3 Trần Hưng Đạo
- địa chỉ: 53 Huỳnh Mẫn Đạt phường 5 Quận 5 TP.HCM ĐT: 0912123456
- 14/20 .an binh p5q5
- 155 Trần Tuần Khải, p5, q5
- Số 1 bạch Vân phường 5 quận 5 TPHCM
- đc hẻm 93/107/16 đường bạch vân p5 q5
- 112 An Bình P5, Quận 5, HCM
- 1025, Phường 5, Quận 5
Response
JSON response example:
[
{
"service_id": "SGN-BIKE",
"data": {
"distance": 11.98,
"duration": 3240,
"distance_fee": 69000,
"request_fee": 17000,
"stop_fee": 0,
"vat_fee": 0,
"discount": 0,
"total_fee": 86000,
"requests": [
{
"_id": "SGN-BIKE-TIP",
"num": 1,
"price": 5000
},
{
"_id": "SGN-BIKE-BULKY",
"num": 0,
"price": 10000,
"tier_code": "TIER_2"
}
],
"total_price": 86000
// order detail
}
},
{
"service_id": "SGN-ECO",
"data": {
"distance": 11.98,
"duration": 3240,
"distance_fee": 60000,
"request_fee": 0,
"stop_fee": 0,
"vat_fee": 0,
"discount": 0,
"total_fee": 60000,
"total_price": 60000
// order detail
}
},
{
"service_id": "SGN-TRUCK-1000",
"data": {
"distance": 13.47,
"duration": 954,
"distance_fee": 515000,
"request_fee": 0,
"stop_fee": 0,
"vat_fee": 0,
"discount": 0,
"total_fee": 515000,
"total_price": 515000
// order detail
}
},
{
"service_id": "VNM-PARTNER-AHAMOVE",
"data": {
"distance": 13.47,
"duration": 3240,
"distance_fee": 72000,
"request_fee": 10000,
"stop_fee": 0,
"vat_fee": 0,
"discount": 0,
"total_fee": 82000,
"total_price": 82000
// order detail
}
}
]
Status-Code: 200 OK
Errors
Code | Text | Description |
---|---|---|
400 | BAD_REQUEST | The request to create the order contains invalid data. |
400 | MISSING_REQUIRED_INFO | Missing required fields. |
400 | MISSING_PATH_INFO | Path does not contain enough stop point. |
401 | NOT_AUTHORIZED | Invalid token (Token expired. When a new token is created, the old token will expire). |
404 | SERVICE_NOT_FOUND | Service not found. |
404 | REQUEST_NOT_FOUND | Special request not found. |
406 | INVALID_MAX_DISTANCE | Delivery distance is invalid, exceeding the allowed distance of the service. |
406 | INVALID_MAX_COD | COD exceeds the maximum COD limit of the service or exceeds the user's COD limit. |
406 | INVALID_MAX_STOP_POINT | The number of delivery points exceeds the maximum number of delivery points allowed by the service. |
406 | INVALID_MIN_STOP_POINT | The number of delivery points does not meet the minimum number of delivery points required by the service. |
406 | SERVICE_NOT_VALID_AT_PICKUP | The service is not supported at the pickup point. |
406 | INVALID_PICKUP_AREA | The service is not supported in the pickup area. |
406 | INVALID_DELIVERY_AREA | The service is not supported in the delivery area. |
406 | INVALID_FUTURE_ORDER_TIME | The scheduled order time is not valid (e.g., scheduled order time is more than a month from the current time). |
500 | INTERNAL_SERVER_ERROR | We had a problem with our server. Try again later. - Unable to determine the province area of the address. - The data transmitted contains fields with incorrect data types. |
503 | SERVICE_UNAVAILABLE | We're temporarily offline for maintenance. Please try again later. |