Webhooks

Learn how to use webhooks to receive Mambu Payments (formerly Numeral) events in your application

1. Introduction to webhooks

Mambu Payments uses webhooks to notify your application when an event is created. Webhooks are particularly helpful for asynchronous events, such as a payment being executed by the bank or an account statement being received from a bank.

Events are created when an object is created or updated, either by a user using the API or the dashboard or by Mambu Payments. An update can be the update of any attribute, such as a status, a date, or any other data.

For each event, Mambu Payments will send a POST request to your API endpoint in JSON format. This API request contains an event object.

2. Registering a webhook

In order to use webhooks, you should create a webhook on your server and register it in the Mambu Payments dashboard. To register a webhook, go to Developers > Webhooks > Add webhook.

You will have to fill a notification email, which will be used to warn you in case we are facing issue with your webhook.

3. Event delivery modes

Events support multiple delivery modes.

Delivery modeOrder guaranteedThroughputDefault delivery mode
Individual eventsYesBase
Batched eventsYesHigh-
Parallel individual eventsNoHigh-
Parallel batched eventsNoHighest-

The order is defined as the order of events for a given object, based on its lifecycle.

To guarantee order, Mambu Payments waits for the acknowledgment of receipt of an event before sending the next event. This means, for instance, that a payment_order.processing event will always be sent before a payment_order.sent event, as per the payment order lifecycle.

There are some edge cases where the order of the messages delivery is not deterministic (or might not be as you expect). For example, if you create a payment order via a sync HTTP API call, you may receive a notification that the payment order is pending_approval even before you get a response for the sync HTTP API call to create the payment order.

When events are sent in parallel, Mambu Payments does not wait for the acknowledgment of receipt of an event before sending the next event. As a result, order is not guaranteed. As an example, payment_order.sent might be delivered before payment_order.processing event.

The maximum number of events in a batch is currently set to 100 for deliverability and performance reasons. Higher limits can be discussed on a case-by-case basis.

Contact us at [email protected] if you would like to receive events other than as individual events.

4. Webhook idempotency

In order to guarantee that each event is unique, every webhook payload includes an idempotency_key attribute within its JSON body. Additionally, when an event is sent individually, the TX-Webhook-ID HTTP header is set to the value of the idempotency_key.

The idempotency key is unique for each event / webhook combination. Therefore, if an event is sent multiple times, it will always carry the same idempotency key value, avoiding duplication error

5. Verifying webhooks

Webhooks sent by Mambu Payments always originate from the same IPs. They can also be signed and authenticated with an API key or using OAuth2.0. Learn more in the dedicated guide.

6. Acknowledgment of receipt

To acknowledge the receipt of an event, your API endpoint must respond with a 2xx HTTP status code to Mambu Payments within 5 seconds.

7. Exponential back-off strategy

If your API endpoint takes longer to respond or returns an HTTP status code different from 2xx, the event will be set to pending_retry status and re-sent up to 5 times during a ~2.8-hour period using an exponential back-off strategy. The event is set to failed status after 6 unsuccessful deliveries.

If the event delivery mode is sequential or batched, Mambu Payments will deactivate the webhook and stop sending events in order to guarantee their order.

We recommended adding a notification email address when configuring your webhook to be notified in case a webhook is deactivated and events are no longer sent.

8. Retry events in case of webhook failure

To retry events after you have fixed your webhook, use the Retry failed events API endpoint or dashboard feature (Developers > Events > Retry failed events).

9. Re-send an event already delivered

To re-send an event previously successfully delivered to the same or another webhook, use the Resend event API endpoint. This can serve different operational purposes like data analysis or reporting.