Skip to main content

8. Webhook

The webhook flow is used to synchronize the shipment status of GHTK orders to the partner’s system via API integration.

info

Assume that an order with GHTK tracking code "S1.A1.17373471" (and code "1234567" in customer system) has been updated to "successfully delivered".

Assume the partner’s callback URL is:

https://doitac.example.com/updateShipment?hash=XXX

Data of GHTK will send to the partner’s callback link the following content:

{
"partner_id" : "1234567",
"label_id": "S1.A1.17373471",
"status_id": 5,
"action_time": "2016-11-02T12:18:39+07:00",
"reason_code": "",
"reason": "",
"weight": 2.4,
"fee": 15000,
"pick_money": 100000,
"return_part_package": 0
}

Request sent from GHTK's server to the partner's system

POST /updateShipment?hash=XXX HTTP/1.1
Host: doitac.example.com
Content-type: application/x-www-form-urlencoded

label_id=S1.A1.17373471&partner_id=1234567&action_time=2016-11-02T12:18:39+07:00&status_id=5&reason_code=&reason=&weight=2.4&fee=1500&return_part_package=0
info

GHTK uses the HTTP Status Code in the response to determine whether the update was successfully received by the partner’s system.

Once receiving response code 200, GHTK will consider the update as successfully delivered to the partner.

HTTP/1.1 200 OK
warning

If no response is received, or if the response code is not 200, GHTK will retry sending the update once.

HTTP/1.1 500 Internal Server Error

List of Parameters Provided to Partners

ParameterData TypeDescription
label_idString- GHTK order code
partner_idString- Partner’s order code
status_idInteger- Order status code
action_timeStringISO 8601 - Order action time
reason_codeString- Update reason code
reasonString- Detailed update reason
weightFloat- Order weight (in kilograms)
feeInteger- Shipping fee (in VND)
return_part_packageInteger- Value = 1 if the order was partially delivered

Order Status

These are the various status transitions that an order can go through in the GHTK system:

ParameterDescription
-1Order Canceled
1Not Yet Received
2Received
3Picked Up / Warehoused
4Out for Delivery / In Delivery
5Delivered / Not Yet Reconciled
6Reconciled
7Pickup Failed
8Pickup Delayed
9Delivery Failed
10Delivery Delayed
11Return Reconciliation Completed
12Pickup Assigned / In Pickup
13Compensation Order
20In Return Process (COD is returning the package)
21Returned (COD has completed the return)
123Shipper Reported Completed Pickup
127Shipper Reported Failed Pickup
128Shipper Reported Pickup Delay
45Shipper Reported Completed Delivery
49Shipper Reported Failed Delivery
410Shipper Reported Delivery Delay
warning

Note: Status codes 123, 127, 128, 45, 49, 410 (reported by shippers) are informational only and do not represent the official status of the order in GHTK's system.

Example: A shipper might update status 123, but due to an error (e.g., accidentally selecting the wrong order), it may be corrected to status 127 later.

Pickup Delay Reasons

Reasons why the pickup is delayed beyond the expected time

reason_code table for pickup delay reasons (status_id = 8)

CodeDescription
100Supplier requested pickup in the next working shift
101GHTK could not contact the supplier
102Supplier does not have the goods ready
103Supplier changed address
104Supplier scheduled a pickup date
105GHTK is overloaded, cannot pick up on time
106Weather or other objective conditions
107Other reason

Pickup Failure Reasons

CodeDescription
110Address is outside the service area
111Items are not eligible for transport
112Supplier canceled the order
113Supplier delayed/ could not be contacted after 3 attempts
114Other reason
115Partner canceled the order via API

Delivery Delay Reasons

CodeDescription
120GHTK is overloaded, cannot deliver on time
121Recipient requested delivery in the next working shift
122Cannot contact the recipient
123Recipient scheduled a delivery date
124Recipient changed delivery address
125Incorrect recipient address, supplier needs to verify
126Weather or other objective conditions
127Other reason
128Partner scheduled a specific delivery time
129Package not found
1200Incorrect recipient phone number, supplier needs to verify

Delivery Failure Reasons

CodeDescription
130Recipient refused to accept the product
131Unable to contact recipient after 3 attempts
132Recipient rescheduled delivery more than 3 times
133Shop requested to cancel the order
134Other reason
135Partner canceled the order via API

Return Delay Reasons

CodeDescription
140Supplier scheduled return in next working shift
141Cannot contact the supplier
142Supplier not at home
143Supplier scheduled a return date
144Other reason