Calculate Fee

API Calculate Fee

 

This API can help Shop/Merchant get the shipping fee and provide to buyer before create shipping order by

input some information such as Weight,Height,length,width ,to_district_ID, to_ward_code, Service_ID.

Caution : The API Order Info need to infusion token in ShopId header

post/get
https://online-gateway.ghn.vn/shiip/public-api/v2/shipping-order/fee
https://dev-online-gateway.ghn.vn/shiip/public-api/v2/shipping-order/fee
curl --location --request POST 'https://dev-online-gateway.ghn.vn/shiip/public-api/v2/shipping-order/fee' \
--header 'Content-Type: application/json' \
--header 'Token: 637170d5-942b-11ea-9821-0281a26fb5d4' \
--header 'ShopId: 885' \
--header 'Content-Type: text/plain' \
--data-raw '{
"from_district_id":1454,
"service_id":53320,
"service_type_id":null,
"to_district_id":1452,
"to_ward_code":"21012",
"height":50,
"length":20,
"weight":200,
"width":20,
"insurance_fee":10000,
"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

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)

service_type_id Int

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

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.

from_district_id Int

District ID pick up parcels.Use API Get District

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

weight Int

Weight (gram)

length Int

Length (cm)

width Int

width (cm)

height Int

height (cm)

{
    "code": 200,
    "message": "Success",
    "data":{
    "total":36300
    "service_fee":36300
    "insurance_fee":0
    "pick_station_fee":0
    "coupon_value":0
    "r2s_fee":0
    }
}
{
    "code": 400,
    "message": "code=400, message=Syntax error: offset=30, error=invalid character '}' after array element, internal=invalid character '}' after array element",
    "data": null
    "code_message": "USER_ERR_COMMON"
}