Skip to main content

Create Order

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=CASH' \
--data-urlencode 'promo_code=KHUYENMAI' \
--data-urlencode 'remarks=This is note for order' \
--data-urlencode 'order_time=0' \
--data-urlencode 'requests=[{"_id":"SGN-BIKE-TIP","num":2}]' \
--data-urlencode 'path=[{"lat":10.7692105,"lng":106.6637935,"address":"725 Hẻm số 7 Thành Thái, Phường 14, Quận 10, Hồ Chí Minh, Việt Nam","short_address":"Quận 10","name":"nmbmb","mobile":"84xxxxxxxxx"},{"lat":10.7828887,"lng":106.704898,"address":"Miss Ao Dai Building, 21 Nguyễn Trung Ngạn, Bến Nghé, Quận 1, Hồ Chí Minh, Vietnam","name":"Bao","mobile":"84xxxxxxxxx","remarks":"call me","cod":85000,"tracking_number":"1234"}]' \
--data-urlencode 'items=[{"_id": "TS","num": 2,"name": "Sua tuoi","price": 15000},{"_id": "ST","num": 2,"name": "Sinh to","price": 30000}]' \
--data-urlencode 'token=<TOKEN_STG>'

Create a new order by user (support both GET/POST method)

HTTP Request

POST https://apistg.ahamove.com/v1/order/create (x-wwww-form-urlencoded)

or

GET https://apistg.ahamove.com/v1/order/create

Parameters

# Parameters
{
"order_time": 0,
"path": [
{
"lat": 10.7692105,
"lng": 106.6637935,
"address": "725 Hẻm số 7 Thành Thái, Phường 14, Quận 10, Hồ Chí Minh, Việt Nam",
"short_address": "Quận 10",
"name": "nmbmb",
"mobile":"84xxxxxxxxx"
},
{
"lat": 10.7828887,
"lng": 106.704898,
"address": "Miss Ao Dai Building, 21 Nguyễn Trung Ngạn, Bến Nghé, Quận 1, Hồ Chí Minh, Vietnam",
"name": "Bao",
"mobile":"84xxxxxxxxx",
"remarks": "call me",
"cod": 85000,
"tracking_number": "1234"
}
],
"service_id": "SGN-BIKE",
"remarks":"This is note for order",
"requests": [
{
"_id": "SGN-BIKE-TIP",
"num": 2
}
],
"images": [],
"promo_code": "KHUYENMAI",
"remarks": "Call me when arrived",
"payment_method": "CASH",
"items": [
{
"_id": "TS",
"num": 2,
"name": "Sua tuoi",
"price": 15000
},
{
"_id": "ST",
"num": 2,
"name": "Sinh to lua mach",
"price": 30000
}
]
}
ParameterTypeRequiredDescription
tokenStringYesThe user Token.
order_timeNumber (Unix timestamp)YesThe pickup time. Set 0 to pickup ASAP.
pathStringYesAt least 2 pairs (described in more detail below).
service_idStringYesAhamove Service ID (SGN-BIKE, SGN-POOL, etc.).
requestsArrayYesJSONArray representing Special Requests.
payment_methodStringYesPayment method chosen by user (BALANCE or CASH/CASH_BY_RECIPIENT)- Require on production after December 1st, 2019.
imagesArrayNoJSONArray representing image urls.
promo_codeStringNoPromo code to discount shipping fee.
remarksStringNoRemarks.
idle_untilNumber (Unix timestamp)YesThe broadcast time. Set idle_until=order_time if order_time > 0. Optional if order_time is 0.
itemsArrayNoJSONArray representing items (for Food Partners)
typeStringNoOrder type, for eg: warehouse, etc … Treat as normal flow incase type is not specified
need_optimize_routeBooleanNoIn case, if partner need Ahamove to optimize route (1 pickup, > 2 drop off points)

Path

Representing From path[0] and multiple Tos path[x], x > 0

ParameterTypeRequiredDescription
addressStringYesAddress of the location.
latNumberYesLatitude of the location (Optional but highly recommended).
lngNumberYesLongitude of the location (Optional but highly recommended).
nameStringYesRecipient's name. Optional if is path[0].
mobileStringYesRecipient's mobile number. Optional if is path[0].
tracking_numberStringNoTracking number for the package (Partner's internal order id, not required but Ahamove highly recommended having this field in path[x]).
remarksStringNoNote to supplier, for multiple delivery points.
codNumberNoCOD amount (Cash on delivery)
require_podBooleanNoIf true, supplier will be required proof of delivery before complete the transaction
buildingStringNoBuilding name for delivery to door
apt_numberStringNoApartment, Suite or Floor number for delivery to door

lat and lng is not required but address field in parameters needs to have correct information as shown in the format below

user_free_text_input, ward, province/district, city



Ex: 135 Nam Kỳ Khởi Nghĩa, Bến Thành, Quận 1, Hồ Chí Minh

Response

JSON response example: // disable prettier format

{
"order_id": "USAGND",
"status": "ASSIGNING",
"shared_link": "https://cloudstg.ahamove.com/share-order/USAGND/84909055578",
"order": {
"_id": "USAGND",
"currency": "VND",
"user_main_account": 0,
"user_bonus_account": 0,
"total_pay": 33000,
"distance": 1.02,
"duration": 268,
"distance_fee": 23000,
"request_fee": 10000,
"stop_fee": 0,
"vat_fee": 0,
"discount": 0,
"path": [
{
"address": "Nhà Thờ Đức Bà, Vietnam",
"lat": 10.7797855,
"lng": 106.6990189
},
{
"address": "Chợ Bến Thành, Vietnam",
"lat": 10.7725451,
"lng": 106.6980413
}
],
"from_location": {
"type": "Point",
"coordinates": [106.6990189, 10.7797855]
},
"requests": [
{
"_id": "SGN-BIKE-TIP",
"num": 2
}
],
"items": [],
"total_fee": 33000,
"remarks": "This is note for order",
"app": "Ahamove",
"service_id": "SGN-BIKE",
"city_id": "SGN",
"user_id": "84xxxxxxxxx",
"user_name": "TEST CREATE AN ORDER",
"user_imei": null,
"create_time": 1565577713.2757928,
"order_time": 1565577713.2757928,
"index": 12,
"status": "ASSIGNING",
"partner": "TESTPARTNER",
"polylines": "ukx`A}rfjS~CuDhHnGlBnA|DoEdFcB|BhBxBtDzBmA",
"online_pay": 0,
"notify_package_return": true,
"uniform_user_feedback": 2,
"pending_period": 100,
"stoppoint_price": 0,
"special_request_price": 10000,
"vat": 0,
"distance_price": 23000,
"voucher_discount": 0,
"subtotal_price": 33000,
"total_price": 33000
}
}

Status-Code: 200 OK

Errors

CodeTextDescription
404Not Found- Token not found (Token has expired. When a new token is created, the old token has expired)
- Path not found
- Service not found
406Not Acceptable- Booking time not valid
- Address not valid
- Request not valid
- Distance not valid
- Invalid pickup area
- Invalid delivery area
- Concurrent order not allowed (If partner not in token)
- Large COD not allowed for first time user
- Post paid not set for partner
- Not supported payment method
- Not enough credit
- User’s phone number associated with
- Token has been used for a partner
- Child order status not valid (When creating parent order)
- Parent order existed for #ABCXYZ (When creating a parent order but child orders already had a parent)
- Idle until not valid (When client sent idle_until < current_time)
- COD is not valid ( When total COD exceeds the maximum value which was configured in service)
- Number of stop points are not valid
408Request timeoutGoogle Distance API does not return results in 10 seconds.
409Conflict- New order not allow (Not allow 2 consecutive orders in 1 minute)
- Tracking number duplicated (Not allow to create duplicated tracking number within 60s)
500Internal Server ErrorWe had a problem with our server. Try again later.
503Service UnavailableWe're temporarily offline for maintenance. Please try again later.