Create Order
Sample test case of create order
Create order when paying for non-cash shipping
- cURL
- JavaScript
curl --location 'https://partner-apistg.ahamove.com/v3/orders' \
--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, Hồ Chí Minh",
"name": "Aha",
"mobile": "84944309348"
},
{
"lat": 10.76487455,
"lng": 106.6744510,
"address": "104 Trần Nhân Tôn, Phường 2, Quận 10, Hồ Chí Minh",
"name": "Nhan",
"mobile": "0912345678"
}
],
"service_id": "SGN-BIKE",
"requests": [],
"payment_method": "BALANCE",
"items": [
{
"_id": "TG",
"num": 1,
"name": "Tủ gỗ nhỏ",
"price": 450000
},
{
"_id": "GDB",
"num": 2,
"name": "Gương để bàn",
"price": 120000
}
]
}'
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, Hồ Chí Minh',
name: 'Aha',
mobile: '84944309348',
},
{
lat: 10.76487455,
lng: 106.674451,
address: '104 Trần Nhân Tôn, Phường 2, Quận 10, Hồ Chí Minh',
name: 'Nhan',
mobile: '0912345678',
},
],
service_id: 'SGN-BIKE',
requests: [],
payment_method: 'BALANCE',
items: [
{
_id: 'TG',
num: 1,
name: 'Tủ gỗ nhỏ',
price: 450000,
},
{
_id: 'GDB',
num: 2,
name: 'Gương để bàn',
price: 120000,
},
],
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow',
};
fetch('https://partner-apistg.ahamove.com/v3/orders', requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
- Check order status on partner portal
The order information will be shown in the partner portal for the partner to check order status and order history
If you hover the mouse pointer over the icon , you can check the status of callback to your webhook URL
- Driver App
Driver do not collect any fee from Sender/Seller or Receiver
- The sample callback via webhook
{
"_id": "22JKP8Y3",
"accept_time": 0,
"city_id": "SGN",
"complete_time": 0,
"create_time": 1664248324.2389245,
"path": [
{
"address": "7/28 Thành Thái, Phường 14, Quận 10, Hồ Chí Minh",
"cod": 0,
"por_info": "",
"mobile": "09xxxxxxxx",
"status": "",
"complete_time": 0,
"fail_time": 0,
"return_time": 0,
"pod_info": "",
"fail_comment": "",
"name": "Aha"
},
{
"address": "104 Trần Nhân Tôn, Phường 2, Quận 10, Hồ Chí Minh",
"cod": 0,
"por_info": "",
"mobile": "09xxxxxxxx",
"status": "",
"complete_time": 0,
"fail_time": 0,
"return_time": 0,
"pod_info": "",
"fail_comment": "",
"name": "Nhan"
}
],
"payment_method": "BALANCE",
"pickup_time": 0,
"service_id": "SGN-BIKE",
"status": "ASSIGNING",
"sub_status": "",
...
}
Create order when paying for shipping in CASH
- Paid by Seller/Sender
Field payment_method
in parameters will be changed into payment_method=CASH
Driver collects Seller/Sender 28.000đ
- Paid by Recipient
Field payment_method
in parameters will be changed into payment_method=CASH_BY_RECIPIENT
Driver collects Receiver 28.000đ
Create order with promo code
- Field
promo_code
is required in parameters as promo_code=AHAKM - Ahamove launchs some coupon code in Staging environment:
AHAKM
(FLAT): Discount value is 10.000đ on shipping feeAHAKM20
(PERCENTAGE ): Discount 20% on shipping fee and max discount is 15.000đAHAKM1
(SAME PRICE): Discount value is 5.000đ for all the order
The total fees is 28.000đ but only 18.000đ left after applying promo code AHAKM
Create order with COD (advance)
Field cod
is required in path[x], x>0
Driver advances to Sender/Seller 50.000đ and collects Receiver 50.000đ
Create order with special requests
Partners can get list of special requests of each type of service in API Get List Of Service and apply when creating order
- cURL
- JavaScript
curl --location 'https://partner-apistg.ahamove.com/v3/orders' \
--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, 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.76487455,
"lng": 106.6744510,
"address": "104 Trần Nhân Tôn, Phường 2, Quận 10, Hồ Chí Minh",
"name": "Nhanh",
"mobile": "0912345678",
"cod": 50000,
}
],
"service_id": "SGN-BIKE",
"requests": [
{
"_id": "SGN-BIKE-TIP",
"num": 1
},
{
"_id": "SGN-BIKE-ROUND-TRIP"
}
],
"payment_method": "BALANCE",
"items": [
{
"_id": "TG",
"num": 1,
"name": "Tủ gỗ nhỏ",
"price": 450000
},
{
"_id": "GDB",
"num": 2,
"name": "Gương để bàn",
"price": 120000
}
]
}'
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, Hồ Chí Minh',
name: 'Aha',
mobile: '84944309348',
},
{
lat: 10.76487455,
lng: 106.674451,
address: '104 Trần Nhân Tôn, Phường 2, Quận 10, Hồ Chí Minh',
name: 'Nhan',
mobile: '0912345678',
cod: 50000,
},
],
service_id: 'SGN-BIKE',
requests: [
{
_id: 'SGN-BIKE-TIP',
num: 1,
},
{
_id: 'SGN-BIKE-ROUND-TRIP',
},
],
payment_method: 'BALANCE',
items: [
{
_id: 'TG',
num: 1,
name: 'Tủ gỗ nhỏ',
price: 450000,
},
{
_id: 'GDB',
num: 2,
name: 'Gương để bàn',
price: 120000,
},
],
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow',
};
fetch('https://partner-apistg.ahamove.com/v3/orders', requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
- Check order status on partner portal
The total fee will include shipping fee and request fee
- Driver App
The special requests will be displayed on screen when the Driver accepts order
Create scheduled order with multiple drop-off points
- cURL
- JavaScript
curl --location 'https://partner-apistg.ahamove.com/v3/orders' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{
"order_time": 0,
"idle_until": 1664249580,
"path": [
{
"lat": 10.76975346,
"lng": 106.6636615,
"address": "7/28 Thành Thái, Phường 14, Quận 10, 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.76487455,
"lng": 106.6744510,
"address": "104 Trần Nhân Tôn, Phường 2, Quận 10, Hồ Chí Minh",
"name": "Nhanh",
"mobile": "0912345678",
"cod": 70000,
},
{
"address": "402 Lê Văn Sỹ, Phường 14, Quận 3, Hồ Chí Minh",
"name": "Tam",
"mobile": "0986754321"
}
],
"service_id": "SGN-BIKE",
"requests": [],
"payment_method": "BALANCE",
"need_optimize_route": True,
"items": [
{
"_id": "TG",
"num": 1,
"name": "Tủ gỗ nhỏ",
"price": 450000
},
{
"_id": "GDB",
"num": 2,
"name": "Gương để bàn",
"price": 120000
}
]
}'
const myHeaders = new Headers();
myHeaders.append('Content-Type', 'application/json');
myHeaders.append('Authorization', 'Bearer <token>');
const raw = JSON.stringify({
order_time: 0,
idle_until: 1664249580,
path: [
{
lat: 10.76975346,
lng: 106.6636615,
address: '7/28 Thành Thái, Phường 14, Quận 10, Hồ Chí Minh',
name: 'Aha',
mobile: '84944309348',
},
{
lat: 10.76487455,
lng: 106.674451,
address: '104 Trần Nhân Tôn, Phường 2, Quận 10, Hồ Chí Minh',
name: 'Nhan',
mobile: '0912345678',
cod: 70000,
},
{
address: '402 Lê Văn Sỹ, Phường 14, Quận 3, Hồ Chí Minh',
name: 'Tam',
mobile: '0986754321',
},
],
service_id: 'SGN-BIKE',
requests: [],
payment_method: 'BALANCE',
need_optimize_route: True,
items: [
{
_id: 'TG',
num: 1,
name: 'Tủ gỗ nhỏ',
price: 450000,
},
{
_id: 'GDB',
num: 2,
name: 'Gương để bàn',
price: 120000,
},
],
});
const requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow',
};
fetch('https://partner-apistg.ahamove.com/v3/orders', requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
- Check the order status
The total fee = Shipping fee + Stop fee
- Driver App
Driver advances to Seller/Sender 70.000đ and collects Receiver at drop-off 1 70.000đ