Notifications and webhooks
The notifications or Webhooks enable you to receive asynchronous notifications of the events that occur on the Airwallex payment acceptance platform.
You can register webhook URLs for Airwallex to notify any time an event happens in your account and any account you were authorized to access. When one of those events is triggered, Airwallex will send a HTTP POST payload to the webhook's configured URL.
- Log into the Airwallex webapp
- On the left hand nav, go to "Developer" and "Webhook"
- "Add webhook" allows you to configure the webhook URL and the events you want to listen for
The table below provides you the different types of events that are available.
|payment_intent.created||A payment intent has been created.|
|payment_intent.requires_payment_method||This payment intent requires payment method to proceed.|
|payment_intent.cancelled||The payment intent has been cancelled.|
|payment_intent.succeeded||A payment intent has been fulfilled.|
|payment_intent.requires_capture||Merchant capture is required to fulfil this payment intent.|
|payment_intent.requires_customer_action||Additional customer action is required to fulfil this payment intent.|
|payment_attempt.received||This payment attempt has been received.|
|payment_attempt.authorized||The payment attempt has been authorized and is waiting to be captured.|
|payment_attempt.authorization_failed||The payment attempt has failed authorization.|
|payment_attempt.capture_requested||The payment attempt has been requested for capture successfully and is therefore fulfilled.|
|payment_attempt.capture_failed||The payment attempt has failed to capture and is therefore terminated.|
|payment_attempt.authentication_redirected||The payment attempt has been redirected for authentication.|
|payment_attempt.authentication_failed||The payment attempt has failed to be authenticated.|
|payment_attempt.failed_to_process||The payment attempt has failed to be processed.|
|payment_attempt.cancelled||The payment attempt has been cancelled.|
|payment_attempt.expired||This payment attempt has expired.|
|payment_attempt.risk_declined||The payment attempt has failed to pass the risk screen|
|payment_attempt.settled||This payment attempt's fund has been received by Airwallex from the acquirer.|
|payment_attempt.paid||This payment attempt's fund has been paid to the merchant's wallet successfully.|
|payment_consent.created||The payment consent has been created|
|payment_consent.verified||The payment consent has been verified|
|payment_consent.updated||The payment consent has been updated|
|payment_consent.disabled||The payment consent has been disabled, the PaymentConsent cannot be used or updated|
|customer.created||A customer has been created.|
|customer.updated||The customer has been updated.|
|refund.received||This refund request has been received and will be processed later.|
|refund.succeeded||This refund has been fulfilled successfully.|
|refund.failed||This refund has failed.|
|payment_method.created||This payment method has been created.|
|payment_method.updated||This payment method has been updated.|
|payment_method.attached||This payment method has been attached to a customer.|
|payment_method.detached||This payment method has been detached from a customer.|
|payment_method.disabled||This payment method has been disabled.|
|payment_method.disabled||This payment method has been disabled.|
|fraud.merchant_notified||This payment has been identified as Fraudulent, merchant to initiate refund and hold delivery of goods/service.|
|dispute.rfi_responded_by_merchant||Merchant responded to RFI.|
|dispute.dispute.pre_chargeback_accepted||Merchant received pre-chargeback and it is auto accepted.|
|dispute.accepted||Merchant accepted the dispute.|
|dispute.dispute_received_by_merchant||Acquirer required merchant to provide evidence for dispute stage.|
|dispute.dispute_responded_by_merchant||Merchant provided evidence for dispute stage.|
|dispute.won||Merchant won the dispute (final result).|
|dispute.lost||Merchant lost the dispute (final result).|
|dispute.dispute_reversed||Dispute is reversed|
The webhook payload is sent as JSON in the POST request body. The full event details are included and can be used directly, after parsing the JSON into an Event object. This Event object contains all the relevant information about what just happened, including id which identifies the event, the accountId which identifies the account this event belongs to, name which specifies the type of event and data associated with that event.
object in data is the same JSON object as the response from a successful API call for getting corresponding data type, as in the links listed below (except for dispute events):
For object of dispute events, see sample payload at Dispute notifications
error object in data contains information about the error occurred, it has 4 possible fields:
message are available for every error object,
source is only for code "validation_error", representing the name of the request parameter that caused the error, and
provider_original_response_code is only for code "provider_declined" or "issuer_declined", representing the original response code from provider.
See following examples of
HTTP POST payloads that are delivered to your webhook\'s configured URL endpoint will contain several special headers:
|x-timestamp||The Long type timestamp, such as 1357872222592.|
|x-signature||The HMAC hex digest of the response body. This header will be sent if the webhook is configured with a secret. The HMAC hex digest is generated using the sha256 hash function and the secret as the HMAC key.|
Respond to webhook events
You must acknowledge the notifications we send you. To acknowledge receipt of an event, your endpoint must return a 200 HTTP status code, when either no answer or another response code is received we will retry. Acknowledge events prior to any logic that needs to take place to prevent timeouts.
Checking webhook signatures
Airwallex can optionally sign the webhook events it sends to your endpoints. We do so by including a signature in each request's header. This allows you to verify that the events were sent by Airwallex. You can verify signatures by following steps.
Before you can verify signatures, you need to retrieve your endpoint's secret from your Webapp. Each secret is unique to the endpoint to which it corresponds. Additionally, if you have multiple endpoints, you must obtain a secret for each one. After this setup, Airwallex starts to sign each webhook it sends to the endpoint.
Extract the x-timestamp and x-signature from the header
Prepare the value_to_digest string. You achieve this by concatenating: the x-timestamp (as a string) and the actual JSON payload (the request's body, as a string)
Compute an HMAC with the SHA-256 hash function. Use the endpoint's signing secret as the key, and use the value_to_digest string as the message.
Compare the x-signature in the header to the expected signature. If a signature matches, compute the difference between the current timestamp and the received timestamp, then decide if the difference is within your tolerance.
Tips for using webhooks
Receive events with an HTTPS server
Please use an HTTPS URL for your webhook endpoint for security considerations. Furthermore, your server must be correctly configured to support HTTPS.
If your webhook endpoint is unavailable or takes too long to respond, Airwallex will resend the notification message several times over the course of three days until a successful response is returned.
Acknowledge events immediately
If your webhook script performs complex logic, it's possible that the script would time out before Airwallex sees its complete execution. Ideally, your webhook handling code (acknowledging receipt of an event by returning a 200 status code) is separate from any processing performed for that event.
Handle duplicate events
Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against receiving duplicate events by making your event processing idempotent.
To deduplicate events, please use the "id" field sent on the event. Across retry, the same event keeps the same "id".
Order of events
Airwallex does not guarantee delivery of events in the order in which they are generated. Your endpoint should not expect delivery of these events in this order and should handle this accordingly. You can also use
created_at in the event for ordering.
Whitelist IP addresses
Airwallex emits Webhook calls using one of the following IPs. To receive webhook calls successfully, these IPs must be whitelisted:
For Production Environment
For Demo Environment