Skip to main content

Webhook

You can set an Webhook URL on the gateway GUI interface. When there is an event, the gateway will notify the event to the Webhook URL. A typical example of a webhook is an event notification when the payment status of an order changes.

img.png

whenever a order status change, a GET request will be sent to the webhook URL, with below parameters.

Parameter nameTypesDescription
typestringEvent Types, fixed value "order"
instancestringMerchant side order number, that is, the merchant_order_id field
codestringEvent code, fixed value "statuschange"
messagestringOrder status changes
signaturestringRequest signature
  • The request can be signed and verified through the signature rule, and the apiUrl in the signature rule uses the full address of the webhook

  • If the webhook address response is 200, the notification is successful, otherwise the notification will be repeated, repeated every 5 seconds, at most 6 times

  • When receiving the webhook notification, the parameters need to be verified. For the verification process, please refer to the signature calculation section below.

  • Note the signature is used for you to validate the web hook is actually come from the Payment Gateway or not. you should validate the signature using the same algorithm as other API call.

Message#

message field value

valueinstruction
Order TimeoutOrder timeout
Order ClosedOrder closed
Order PaidOrder Paid
Order RefundedOrder partial refund/full refund

Webhook notification example#

URLwebhook address
MethodGET

Request content#

Example in Query string#

{https://yoururlwebhooksetup}?code=StatusChange&instance=test_linepay01&message=Order%20Paid&signature=DA0608731FA24D4C8694D839A2D990D4AEDF3A897126C09BE4C9D6B4DB605932&type=Order

Example in Postman#

webhook_sample_request.png

Test a webhook endpoint#

If you don't have public url you can setup Webhook URL to send some test webhook like https://webhook.site

or you can read info about Test WebHook registration with request logging site from Microsoft.