Webhook
A webhook allows you to connect a platform to a stream of future events. Wonder allows your pass callback_url
on create order request body,
then Wonder will be send a HTTP POST request after order & transaction state changed.
Each webhook request included headers:
- Credential. Please refer to Authentication.
- Nonce. Please refer to Authentication.
- Signature. When you generate the appid in Wonder Dashboard you will download the
Webhook Public Key
, which you can use to authenticate theSignature
. - Content-Type.
- X-Action: A event name of this webhook.
Actions
Lists the relationship between different actions and order statuses:
X-Action | state(order state) | correspondence_state(payment state) |
---|---|---|
order.created | invoiced | unpaid |
order.paid(partial) | in_completed | partial_paid |
order.paid(fully) | completed | paid |
order.payment_failure | invoiced | unpaid |
order.voided | voided | unpaid |
order.refunded(partial) | in_completed | partial_paid |
order.refunded(fully) | completed | refunded |
transaction.voided(parital) | in_completed | partial_paid |
transaction.voided(fully) | completed | voided |
Process Webhook
- Make sure your Webhook endpoint is accessible via the Internet.
- As long as the HTTP Code is 2xx, the webhook processed successfully. We have found that some HTTP frameworks return 201 as success by default, so we define a 2xx code as success.
- If a network error occurs or a 5xx is returned, the retry logic is triggered.
- To enhance the usability of your application, we also recommend that your application uses the Query Order API for state synchronization.
If you have firewall requirements and need to allow specific IP addresses to access your production environment, please add the following IP addresses to your firewall whitelist: 119.8.39.23/32 119.8.232.135/32
Verify Signature
When you create an appid, the Wonder Dashboard will return the Webhook Signature Public Key, use this Public Key to verify the Signature.
Please refer to Authentication check details.
Retry logics
The system will retry up to 15 times, with a maximum of 6 hours between retries.
15 retries will be sent within 24 hours.
Synchronous and Asynchronous
In order to deliver the webhook faster, we use the following strategy for process, Synchronous process for first webhook process, and Asynchronous process for all retries.
Synchronous : Sending webhook in the same thread as the API processing, there is a possibility that the webhook will arrive earlier than the API Response, possibly due to network reasons.