Webhooks

Asynchronous notifications will be sent to the Merchant when a Payment, Refund or other transaction changes status. The Merchant must provide a Notification URL for receiving such notifications. This URL must be HTTPS, accessible via Internet and with a valid SSL certificate issued from a trusted Certificate Authority.

For the callback to succeed, the system expects a 2xx HTTP status code within 20 seconds of the notification call (connect timeout 10 seconds, read timeout 20 seconds). Otherwise, the notification will be treated as unsent and The Kingdom Bank will try to send it again later. Please note that multiple notifications may be sent for the same payment (matching the same foreignTransactionId).

The HTTP method used for sending the notification will be POST, with JSON content, sent with Content-Type: application/json; charset=UTF-8.

It is highly recommended to validate the incoming webhook by calculating a signature of its body (using the algorithm for request signing) and comparing it with the X-Signature header. The notification is signed with one of your active Signature Keys, not necessarily the one used for the original request; the X-Signature-Key-Id header always holds the Key ID of the key used.

As an additional security measure, you can whitelist the IPs that The Kingdom Bank will be using to send webhooks. The list is available from your integration manager upon request.

Payment status

Every notification will send a status denoting what has happened with the payment. Below is a table describing the different statuses.

StatusDescription
FAILEDThe payment has failed due to an error reported by the downstream processor, the customer or our backoffice cancelled the payment, or the payment timed out on The Kingdom Bank's side
PENDINGThe payment is pending confirmation from the customer. At this point, the payment may or may not be processed
SCHEDULEDThe customer has instructed the payment but the money has not yet reached our settlement account. Since there is a risk that the payment may be cancelled, the money is not yet added to your merchant account balance. Typically, when receiving this status, you would reserve the item in your inventory, but wait until the PROCESSED notification for the actual shipment.
PROCESSEDThe customer completed the payment and the money has been added to your merchant account balance
OVERPAID, UNDERPAIDDeprecated. Sent when the customer paid more or less than requested; rely on the overpaid and underpaid flags of the notification instead

The full notification body is described under Callbacks on each operation that takes a notificationUrl, for example Create Payment Request.

Notifications Retry algorithm

Notifications are retried up to 12 times in the span of 4 days after which they need to be manually resent

AttemptDelay after previous attempt
1Immediately after status change
23 seconds
35 seconds
415 seconds
530 seconds
61 minute
75 minutes
815 minutes
930 minutes
103 hours
116 hours
121 day
133 days