Skip to main content

4. Calculate Shipping Fee API

This API provides the shipping fee based on given pickup & delivery address and the package weight.

Request

Endpoint

GET /services/shipment/fee

Headers

Token: {API_TOKEN}
X-Client-Source: {PARTNER_CODE}

Input parameters:

ParameterDatatypeMandatory (Y)/(N)Description
pick_address_idStringNAddress ID to pick up the order. This input takes precedence in identifying the pick up address if not null/empty. These ID can be found in tab "Edit shop information". If pick_address_id is valid, province name, district name,… of pick up address will be following this ID.
pick_addressStringNAddress string to pick up the order
pick_provinceStringYProvince to pick up the order
pick_districtStringYDistrict to pick up the order
pick_wardStringNWard to pick up the order
pick_streetStringNStreet to pick up the order
addressStringNDetailed address to deliver the order
provinceStringYProvince to deliver the order
districtStringYDistrict to deliver the order
wardStringNWard to deliver the order
streetStringNStreet to deliver the order
weightIntegerYDeclared weight of the product (gram)
valueIntegerNDeclared monetary value of the order package. The insurance fee is calculated based on this value. (in VND)
transportStringNThis is the transportation method to deliver the parcel. Possible value is "fly" or "road". If the transportation method is invalid, GHTK will switch automatically to default transportation method
deliver_optionStringYPossible value is "xteam" or "none". Using "xteam" when the delivery method is Xfast.
tagsArrayNPossible value is [1] if the order has fragile product or [7] if the order has farm product, dry food.

Code

GET /services/shipment/fee?address=P.503%20t%C3%B2a%20nh%C3%A0%20Auu%20Vi%E1%BB%87t,%20s%E1%BB%91%201%20L%C3%AA%20%C4%90%E1%BB%A9c%20Th%E1%BB%8D&province=H%C3%A0%20n%E1%BB%99i&district=Qu%E1%BA%ADn%20C%E1%BA%A7u%20Gi%E1%BA%A5y&pick_province=H%C3%A0%20N%E1%BB%99i&pick_district=Qu%E1%BA%ADn%20Hai%20B%C3%A0%20Tr%C6%B0ng&weight=1000&value=3000000&deliver_option=xteam HTTP/1.1
Token: {API_TOKEN}
X-Client-Source: {PARTNER_CODE}

Response

Response description

FieldDatatypeDescription
fee.nameStringName of applied shipping rate Possible values: area1, area2, area3
fee.feeIntegerShipping fee amount (in VND)
fee.insurance_feeIntegerInsurance fee amount (in VND)
fee.deliveryBooleanIf the delivery address is supported by GHTK, respone is "true". If it is not supported, the respone is "false".

Successful request

{
"success": true,
"message": "",
"fee": {
"name": "area1",
"fee": 30400,
"insurance_fee": 15000,
"delivery_type": "only_hanoi",
"a": 3,
"dt": "local",
"extFees": [
{
"display": "(+ 7,400 đ)",
"title": "Phụ phí hàng dễ vỡ",
"amount": 7400,
"type": "fragile"
},
{
"display": "(+ 13,400 đ)",
"title": "Phụ phí hàng nông sản/thực phẩm khô",
"amount": 13400,
"type": "food"
}
],
"delivery": true
}
}

Note:

info

In cases where pick_address_id has a valid value, the province, district, etc., information of the pickup point will be retrieved based on this address code. The fields pick_province and pick_district are not required.

Introduce the variable deliver_option = xteam to calculate shipping fees for XFast (an express delivery service).