API Create Order
Automatic send order information such as weight, address, phone number and many more to GHN system. We will process these information and start the shipment
Caution : The API Create Order need to infusion token and shopid in header
post/gethttps://online-gateway.ghn.vn/shiip/public-api/v2/shipping-order/create
https://dev-online-gateway.ghn.vn/shiip/public-api/v2/shipping-order/create
curl --location --request POST 'https://dev-online-gateway.ghn.vn/shiip/public-api/v2/shipping-order/create' \
--header 'Content-Type: application/json' \
--header 'ShopId: 885' \
--header 'Token: 285518-c4bb-11ea-be3a-f636b1deefb9' \
--data-raw '{
"payment_type_id": 2,
"note": "Tintest 123",
"required_note": "KHONGCHOXEMHANG",
"return_phone": "0332190444",
"return_address": "39 NTT",
"return_district_id": null,
"return_ward_code": "",
"client_order_code": "",
"to_name": "TinTest124",
"to_phone": "0987654321",
"to_address": "72 Thành Thái, Phường 14, Quận 10, Hồ Chí Minh, Vietnam",
"to_ward_code": "20308",
"to_district_id": 1444,
"cod_amount": 200000,
"content": "Theo New York Times",
"weight": 200,
"length": 1,
"width": 19,
"height": 10,
"pick_station_id": 1444,
"deliver_station_id": null,
"insurance_value": 10000000,
"service_id": 0,
"service_type_id":2,
"coupon":null,
"pick_shift":[2],
"items": [
{
"name":"Áo Polo",
"code":"Polo123",
"quantity": 1,
"price": 200000,
"length": 12,
"width": 12,
"height": 12,
"weight": 1200,
"category":
{
"level1":"Áo"
}
}
]
}'
Parameter
Field | Require | Type | Data Size | Description |
---|---|---|---|---|
token | String |
Must be sent with all client requests. This Token helps server to validate request source. Provided by GHN. |
||
shop_id | Int |
Manage information for shop/seller |
||
to_name | String | 1024 |
Client name. (Customer / Buyer) |
|
to_phone | String |
Client phone number.(Customer / Buyer) |
||
to_address | String | 1024 |
Client address.(Customer / Buyer) |
|
to_ward_code | String |
Ward Code pick up parcels.Use API Get Ward, API Get WardCode : https://api.ghn.vn/home/docs/detail?id=61 Phường/Xã của người nhận hàng. You can input to_ward_name |
||
to_district_id | Int |
District ID drop off parcels.Use API Get District API Get District : https://api.ghn.vn/home/docs/detail?id=78 You can input to_district_name and to_province_name |
||
return_phone | String |
Contact phone number to return parcels. |
||
return_address | String | 1024 |
Address return parcels. |
|
return_district_id | Int |
District ID return parcels. Use API GetDistricts API Get District : https://api.ghn.vn/home/docs/detail?id=78 |
||
return_ward_code | String |
Ward Code return parcels. Use API Get Ward. API Get WardCode: https://api.ghn.vn/home/docs/detail?id=61 |
||
client_order_code | String | 50 |
External order code managed by logged client [Unique field]. Default value: Note: Client_order_code will get back the order that already has this Client_order_code
|
|
cod_amount | Int |
Amount cash to collect. Maximum Default value: |
||
content | String | 2000 |
Content for order |
|
weight | Int |
Weight (gram) Maximum : 30000gram |
||
length | Int |
Length (cm) Maximum : 150cm |
||
width | Int |
width (cm) Maximum : 150cm |
||
height | Int |
height (cm) Maximum : 150cm |
||
pick_station_id | Int |
The shipper not pickup parcels at shop’s address Value > 0 |
||
insurance_value | Int |
Use to declare parcel value. GHN will base on this value for compensation if any unexpected things happen (lost, broken...). Maximum Default value: |
||
coupon | String |
Coupon Code for discount. |
||
service_type_id | Int |
Call API SERVICE to show service. Default value: If not input |
||
service_id | Int |
Call API SERVICE to show service. If not input |
||
payment_type_id | Int |
Choose who pay shipping fee.
|
||
note | String | 5000 |
Client note for shipper. Ex: Please call before delivery |
|
required_note | String | 500 |
Note shipping order.Allowed values:
|
|
pick_shift |
Picking shift , take API Pick Shift |
|||
Items |
Content for order |
|||
name | String |
Name of product |
||
code | String |
Code of product |
||
quantity | Int |
Quantity of product |
||
price | Int |
Price of product |
||
length | Int |
Length of product |
||
weight | Int |
Weight of product If you input |
||
width | Int |
Width of product |
||
height | Int |
Height of product |
||
category |
Category of product have 3 level, |
|||
level1 | String |
Product category classification |
{
"code": 200,
"message": "Success",
"data":
{
"district_encode":""
"expected_delivery_time":"2020-06-03T16:00:00Z"
"fee":
{
coupon:0
"insurance":11000
"main_service":22000
"r2s":0
"return":0
"station_do":0
"station_pu":0
},
"order_code":"FFFNL9HH"
"sort_code":"19-60-06"
"total_fee":"33000"
"trans_type":"truck"
"ward_encode":""
}
}
Structure Response
Field | Description |
---|---|
expected_delivery_time |
Expected delivery time. |
fee |
Fee. |
coupon |
Coupon Code for discount. |
insurance |
Insuarance value |
main_service |
Service fee |
r2s |
Fee of delivery parcel again |
return |
Fee of Return to ship |
station_do |
Pickup fee at Station |
station_pu |
Delivery fee at Station |
order_code |
Code order |
sort_code |
Sort code |
total_fee |
Total fee |
trans_type |
Transportation type |
{
"code": 400,
"message": "Sai thông tin Required Note",
"data": null
"code_message":"USER_ERR_COMMON"
}