Create Order

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/get
https://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": "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": "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,
    "order_value":130000,
    "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 Description
token Require String

Must be sent with all client requests. This Token helps server to validate request source. Provided by GHN.

shop_id Require Int

Manage information for shop/seller

to_name Require String

Client name. (Customer / Buyer)

to_phone Require String

Client phone number.(Customer / Buyer)

to_address Require String

Client address.(Customer / Buyer)

to_ward_code Require String

Ward Code pick up parcels.Use API Get Ward

to_district_id Require Int

District ID drop off parcels.Use API Get District

return_phone   String

Contact phone number to return parcels.

return_address   String

Address return parcels.

return_district_id   Int

District ID return parcels. Use API GetDistricts

return_ward_code   String

Ward Code return parcels. Use API Get Ward.

client_order_code   String

External order code managed by logged client [Unique field].

Default value: null

cod_amount   Int

Amount cash to collect.

Maximum 50.000.000

Default value: 0

content   String

Content for order

weight Require Int

Weight (gram)

Maximum : 1600000gram
length Require Int

Length (cm)

Maximum : 200cm
width Require Int

width (cm)

Maximum : 200cm
height Require Int

height (cm)

Maximum : 200cm
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 10.000.000

Default value: 0

coupon   String

Coupon Code for discount.

service_type_id Require Int

Input value 1: Air , 2: Truck  (if not input service_id)

service_id Require Int

Choose which Sevice ID suitable with your shipping plan (Express, Standard or Saving). Each Service ID has different fee and leadtime.

Use API Get service (if not input service_type_id)

payment_type_id Require Int

Choose who pay shipping fee.

1: Shop/Seller.

2: Buyer/Consignee.

note   String

Client note for shipper.

Ex: Please call before delivery

required_note Require String

Note shipping order.Allowed values: CHOTHUHANG, CHOXEMHANGKHONGTHU, KHONGCHOXEMHANG

pick_shift    

Picking shift , take API Pick Shift

Items Require  

Content for order

name Require String

Name of product

code   String

Code of product

quantity Require Int

Quantity of product

price   Int

Price of product

length   Int

Length of product

width   Int

Width of product

height   Int

Height of product

category    

Category of product have 3 level,level1, level2, level3

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":""
    }
}
{
    "code": 400,
    "message": "Sai thông tin Required Note",
    "data": null
    "code_message":"USER_ERR_COMMON"
}