Skip to main content

6. Fee Calculation API

The API is used to calculate the shipping fee and other related surcharges for the order based on information such as the pickup address, delivery address, weight, and the selected service for the order ...

Request

GET /services/shipment/fee

Headers

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

Parameters

ParametersRequiredDescription
pick_address_idnoString - Pickup location ID from the customer’s order management page. This field will take priority if not empty
pick_addressnoString - Short pickup address (e.g., House No. 5, Block 3, Alley 11, Lane 45)
pick_provinceyesString - Province/City of the pickup location
pick_districtyesString - District of the pickup location
pick_wardnoString - Ward/Commune of the pickup location
pick_streetnoString - Street name of the pickup location
addressnoString - Detailed delivery address (e.g., CT1 Building, Alley 58, Tran Binh Street)
provinceyesString - Province/City of the recipient
districtyesString - District of the recipient
wardnoString - Ward/Commune of the recipient
streetnoString - Street name of the recipient
weightyesInteger - Weight of items in packages, unit: Gram
valuenoInteger - The actual value of the order used to calculate the insurance fee, unit: VNĐ
transportnoString - Transportation method: "road" (by land), "fly" (by air). If the shipping method is invalid, GHTK will automatically default to the standard shipping method
deliver_optionyesString - Use the xfast shipping method. Accepts one of two values: "xteam" or "none"
tagsnoarray - Add tags to the order. Pass the order tag values into the tags array

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 Information

ParameterDescription
fee.nameString - Name of the applied pricing package. Possible values: area1, area2, area3
fee.feeInteger - Shipping cost, calculated in VND
fee.insurance_feeInteger - Insurance fee, calculated in VND
fee.deliveryBoolean - Indicates whether delivery is supported at this address. If GHTK supports delivery to the location, it returns true; otherwise, if delivery is not supported in this area, it returns false

Success

{
"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 case pick_address_id has a valid value, the information such as province, district, etc., of the pickup address will be taken according to this address ID, and the fields pick_province, pick_district are not required to be submitted

  • Add the variable deliver_option = xteam to calculate the shipping fee for the xfast package.