Preview Order

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/get
https://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
}'

Parameter

Field Type 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

Client name. (Customer / Buyer)

to_phone String

Client phone number.(Customer / Buyer)

to_address String

Client address.(Customer / Buyer)

to_ward_code String

Ward Code pick up parcels.Use API Get Ward

to_district_id 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 Int

Weight (gram)

length Int

Length (cm)

width Int

width (cm)

height Int

height (cm)

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 Int

Input value 1: Express , 2: Standard or 3: Saving (if not input service_id)

service_id 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 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 String

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

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