API Preview Order
Helps preview order information without creating an order
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/preview
https://dev-online-gateway.ghn.vn/shiip/public-api/v2/shipping-order/preview
curl --location --request POST 'https://online-gateway.ghn.vn/shiip/public-api/v2/shipping-order/preview' \
--header 'token: 637170d5-942b-11ea-9821-0281a26fb5d4' \
--header 'Content-Type: application/json' \
--header 'ShopId: 361917' \
--data-raw'{
"payment_type_id": 2,
"note": "Tintest 123",
"required_note": "KHONGCHOXEMHANG",
"return_phone": "0332190458",
"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": "20107",
"to_district_id": 1442,
"cod_amount": 200000,
"content": "ABCDEF",
"weight": 200,
"length": 15,
"width": 15,
"height": 15,
"pick_station_id": 0,
"insurance_value": 2000000,
"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,
"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 |
||
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 |
||
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 |
||
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 |
||
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": {
"order_code".:""
"sort_code".:"19-60-06"
"trans_type".:"truck"
"ward_encode".:""
"district_encode":""
"fee":{
"main_service":22000
"insurance":11000
"station_do".:0
"station_pu".:0
"return".:0
"r2s".:0
coupon:0
},
"total_fee".:"33000"
"expected_delivery_time":"2020-06-03T16:00:00Z"
}
}
Structure Response
Field | Description |
---|---|
order_code |
Code orders |
sort_code |
Sort code |
trans_type |
Transportation type |
fee |
Fee |
main_service |
Main of service fee |
insurance |
Insurance value |
station_do |
Pickup fee at Station |
station_pu |
Delivery fee at Station |
return |
Fee of Return to ship |
r2s |
Fee of delivery parcel again |
coupon |
Coupon Code for discount. |
total_fee |
Total fee |
expected_delivery_time |
Expected delivery time |
{
"code": 400,
"message": "Sai thông tin Required Note",
"data": null
"code_message":"USER_ERR_COMMON"
}