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.
whenever a order status change, a GET request will be sent to the webhook URL, with below parameters.
Parameter name | Types | Description |
---|---|---|
type | string | Event Types, fixed value "order" |
instance | string | Merchant side order number, that is, the merchant_order_id field |
code | string | Event code, fixed value "statuschange" |
message | string | Order status changes |
signature | string | Request 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.
#
Messagemessage field value
value | instruction |
---|---|
Order Timeout | Order timeout |
Order Closed | Order closed |
Order Paid | Order Paid |
Order Refunded | Order partial refund/full refund |
#
Webhook notification exampleURL | webhook address |
---|---|
Method | GET |
#
Request content#
Example in Query string#
Example in Postman#
Test a webhook endpointIf 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.