Skip to main content

Webhook

Process Description

Baokim sends webhooks to the partner's system using the POST method, with data signed according to the mechanism described in the Security Method section. Baokim records the webhook as successfully sent when the response body contains the parameter code with a value of 0, 100 or 200 (the Partner responded with Success).

Cases where the webhook is considered failed include:

  • http_code is 4xx or 5xx (HTTP connection error)
  • http_code = 200 but the response body contains a code other than 0, 100 or 200

If the webhook is recorded as failed, Baokim will resend the webhook for up to 9 more attempts, with the interval between attempts based on the Fibonacci sequence, for example the retry schedule:

  • Attempt 1: 1 minute after the initial send
  • Attempt 2: 2 minutes after attempt 1
  • Attempt 3: 3 minutes after attempt 2
  • Attempt 4: 5 minutes after attempt 3
  • ...

Response

(Returned by the Merchant to Baokim)

note

HTTP 200 - Success

Main Parameters Table

Field NameData TypeRequiredDescription
codeInteger0, 100 or 200 = success, 99 = Baokim will resend the webhook
messageStringResponse content
dataObjectAttached data (if any)

Successful Response Example

{
"code": 100,
"message": "Success",
"data": { }
}

Failed Response Example

{
"code": 99,
"message": "Failure",
"data": { }
}

Error Codes

Error CodeDescription
0, 100 or 200Success
99Failure (retry required)