Create Order
Create order when paying for non-cash shipping
- cURL
- JavaScript
curl --request POST \
--url https://apistg.ahamove.com/v1/order/create \
--header 'Cache-Control: no-cache' \
--header 'accept: application/json' \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode 'service_id=SGN-BIKE' \
--data-urlencode 'payment_method=BALANCE' \
--data-urlencode 'order_time=0' \
--data-urlencode 'requests=[]' \
--data-urlencode 'path=[{"address":"7/28 Thành Thái, Phường 14, Quận 10, Hồ Chí Minh","name":"Aha","mobile":"09xxxxxxxx"},{"address":"104 Trần Nhân Tôn, Phường 2, Quận 10, Hồ Chí Minh","name":"Nhan","mobile":"09xxxxxxxx"}]' \
--data-urlencode 'token=<TOKEN_STG>'
var myHeaders = new Headers();
myHeaders.append('accept', 'application/json');
myHeaders.append('content-type', 'application/x-www-form-urlencoded');
var urlencoded = new URLSearchParams();
urlencoded.append('service_id', 'SGN-BIKE');
urlencoded.append('payment_method', 'BALANCE');
urlencoded.append('order_time', '0');
urlencoded.append('requests', '[]');
urlencoded.append(
'path',
'[{"address":"7/28 Thành Thái, Phường 14, Quận 10, Hồ Chí Minh","name":"Aha","mobile":"09xxxxxxxx"},{"address":"104 Trần Nhân Tôn, Phường 2, Quận 10, Hồ Chí Minh","name":"Nhan","mobile":"09xxxxxxxx"}]'
);
urlencoded.append('token', '<TOKEN_STG>');
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow',
};
fetch('https://apistg.ahamove.com/v1/order/create', requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log('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 --request POST \
--url https://apistg.ahamove.com/v1/order/create \
--header 'Cache-Control: no-cache' \
--header 'accept: application/json' \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode 'service_id=SGN-BIKE' \
--data-urlencode 'payment_method=BALANCE' \
--data-urlencode 'order_time=0' \
--data-urlencode 'requests=[{"_id":"SGN-BIKE-ROUND-TRIP","price":23000},{"_id":"SGN-BIKE-TIP","num":2,"price":5000}]' \
--data-urlencode 'path=[{"address":"7/28 Thành Thái, Phường 14, Quận 10, Hồ Chí Minh","name":"Aha","mobile":"09xxxxxxxx"},{"address":"104 Trần Nhân Tôn, Phường 2, Quận 10, Hồ Chí Minh","name":"Nhan","mobile":"09xxxxxxxx","cod":50000}]' \
--data-urlencode 'token=<TOKEN_STG>'
var myHeaders = new Headers();
myHeaders.append('accept', 'application/json');
myHeaders.append('content-type', 'application/x-www-form-urlencoded');
var urlencoded = new URLSearchParams();
urlencoded.append('service_id', 'SGN-BIKE');
urlencoded.append('payment_method', 'BALANCE');
urlencoded.append('order_time', '0');
urlencoded.append(
'requests',
'[{"_id":"SGN-BIKE-ROUND-TRIP","price":23000},{"_id":"SGN-BIKE-TIP","num":2,"price":5000}]'
);
urlencoded.append(
'path',
'[{"address":"7/28 Thành Thái, Phường 14, Quận 10, Hồ Chí Minh","name":"Aha","mobile":"09xxxxxxxx"},{"address":"104 Trần Nhân Tôn, Phường 2, Quận 10, Hồ Chí Minh","name":"Nhan","mobile":"09xxxxxxxx","cod":50000}]'
);
urlencoded.append('token', '<TOKEN_STG>');
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow',
};
fetch('https://apistg.ahamove.com/v1/order/create', requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log('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 --request POST \
--url https://apistg.ahamove.com/v1/order/create \
--header 'Cache-Control: no-cache' \
--header 'accept: application/json' \
--header 'content-type: application/x-www-form-urlencoded' \
--data-urlencode 'service_id=SGN-BIKE' \
--data-urlencode 'payment_method=BALANCE' \
--data-urlencode 'order_time=0' \
--data-urlencode 'requests=[]' \
--data-urlencode 'need_optimize_route=True' \
--data-urlencode 'idle_until=1664249580' \
--data-urlencode 'path=[{"address":"7/28 Thành Thái, Phường 14, Quận 10, Hồ Chí Minh","name":"Aha","mobile":"0963708070"},{"address":"104 Trần Nhân Tôn, Phường 2, Quận 10, Hồ Chí Minh","name":"Nhan","mobile":"09xxxxxxxx","cod":70000},{"address":"402 Lê Văn Sỹ, Phường 14, Quận 3, Hồ Chí Minh", "name":"Tam","mobile":"09xxxxxxxx"}]' \
--data-urlencode 'token=<TOKEN_STG>'
var myHeaders = new Headers();
myHeaders.append('accept', 'application/json');
myHeaders.append('content-type', 'application/x-www-form-urlencoded');
var urlencoded = new URLSearchParams();
urlencoded.append('service_id', 'SGN-BIKE');
urlencoded.append('payment_method', 'BALANCE');
urlencoded.append('order_time', '0');
urlencoded.append('requests', '[]');
urlencoded.append('need_optimize_route', 'True');
urlencoded.append('idle_until', '1664249580');
urlencoded.append(
'path',
'[{"address":"7/28 Thành Thái, Phường 14, Quận 10, Hồ Chí Minh","name":"Aha","mobile":"0963708070"},{"address":"104 Trần Nhân Tôn, Phường 2, Quận 10, Hồ Chí Minh","name":"Nhan","mobile":"09xxxxxxxx","cod":70000},{"address":"402 Lê Văn Sỹ, Phường 14, Quận 3, Hồ Chí Minh", "name":"Tam","mobile":"09xxxxxxxx"}]'
);
urlencoded.append('token', '<TOKEN_STG>');
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow',
};
fetch('https://apistg.ahamove.com/v1/order/create', requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log('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đ