1. Home
  2. Docs
  3. TikiNOW Smart Logistics
  4. API References
  5. Fulfillment Service Group
  6. Order Service
  7. Webhook Sync Status

Webhook Sync Status

1. Data payload

Canceled status

{
  "data": {
    "date": "2022-10-26T14:22:46+07:00",
    "ref_code": "EXT123123",
    "order_code": "347171821",
    "main_state": "canceled",
    "extra_info": {
      "cancel_reason_code": "202",
      "cancel_reason": "Đặt trùng"
    }
  }
}

Others status

{
  "data": {
    "date": "2022-10-26T14:22:05+07:00",
    "ref_code": "TR22",
    "order_code": "347171821",
    "main_state": "processing",
    "main_substate": "ready_for_pickup"
  }
}

Description:

  • date: date at status change
  • ref_code: customer order code
  • order_code: TNSL code
  • status: order status
  • extra_info: when order status is canceled
  • extra_info.cancel_reason_code: cancel reason code
  • extra_info.cancel_reason: cancel reason

2. Authentication signature

Using HMAC-SHA1 signature. TikiNOW provided webhook secret for client and formula generate HMAC-SHA1 signature. Using this signature to compare with signature on header request (key on header: x-signature).

Example Golang code

func GenerateSignature(secretToken, payloadBody string) string {
    mac := hmac.New(sha1.New, []byte(secretToken))
    mac.Write([]byte(payloadBody))
    expectedMAC := mac.Sum(nil)
    return "sha1=" + hex.EncodeToString(expectedMAC)
}

Return HTTP status 2xx when received successfully and 5xx when failed

Example

curl --location 'https://your-domain/order/webhooks' \
--header 'Content-Type: application/json' \
--header 'x-signature: sha1=312ece04f931ba89b03bbd9bee51ae8c658a29f3' \
--data '{"data":{"date":"2023-05-15T14:30:44+07:00","ref_code":"#100012N01","order_code":"998471271","main_state":"awaiting_confirmation","main_substate":"order_verified"}}'

Data response

HTTP Status CodeDescriptionResponse
2xxSuccess{
“success”: true
}
4xxError{
    “success”: false
    “error”: {
        “code”: “CLIENT_NOT_EXIST”,
        “message”: “Client doesn’t exist”,
    },
}
5xxServer error{
    “success”: false
    “error”: {
        “code”: “BAD_GATEWAY”,
        “message”: “Bad gateway”,
    },
}
Was this article helpful to you? Yes No

How can we help?

Leave a Reply

Your email address will not be published.