Guides

Webhook V2

Introduction

In Webhook v2, we have restructured the webhook event format and enriched its content for each event type. Compared to Webhook v1, it now provides more detailed information. Additionally, the webhook structure has been redesigned to follow an object-based format.

With Webhook v2, you can configure a retry count for events that your server fails to receive and specify the delay between each retry. The maximum number of retries is 5, and the maximum delay is 180 seconds.

Furthermore, the use of the webhook secret key is now mandatory. This key is included in the headers of the webhook event as the value of the myfatoorah-signature header, ensuring secure event verification.

To know more about the signature, please refer to MyFatoorah Signature

❗️

SSL

SSL is required. Ensure that your server is configured to support HTTPS, with a valid server certificate.

Webhook v2 configuration

How it Works

📘

Portal account

Before you build Your Endpoint, you need to set up your webhook information in your portal account as described in the Webhook Information section.

To receive and process events, you need to set up your server and provide a URL where the webhook can take place. The URL will be something like that:
https://www.yourwebsite.com/your-endpoint-name

MyFatoorah webhook will request your endpoint with a RESTful call. It means your endpoint will receive a JSON body with event data that will be in the following structure.

Input ParameterTypeDescription
Event.Codenumber1 For PAYMENT_STATUS_CHANGED
2 For REFUND_STATUS_CHANGED
3 For BALANCE_TRANSFERRED
4 For SUPPLIER_STATUS_CHANGED
5 For RECURRING_UPDATES
Event.NamestringPAYMENT_STATUS_CHANGED
REFUND_STATUS_CHANGED
BALANCE_TRANSFERRED
SUPPLIER_STATUS_CHANGED
RECURRING_UPDATES
Event.CountryIsoCodestringThe country for the event portal with 3 alpha ISO format
Event.CreationDatedatetimeThe event date time format is ISO 8601 "yyyy-MM-ddTHH:mm:ssZ".
The time is in UTC Time zone.
Event.ReferencestringThe reference of the webhook event. Each webhook has its unique reference.
DataobjectContains the content of the webhook event.

For now, we support five types of events:

  1. PAYMENT STATUS CHANGED:
    This will notify your system of the transaction status (success, failed). You will find the needed information about this event in the Payment Status Data Model section.

👍

Updating Order Status in your System

As a best practice, we recommend relying on both the webhook and GetPaymentStatus to update your system with the latest status of the transaction.

🚧

Two Webhook Events for the same Transaction

In some rare scenarios, you may receive two webhook events for the same transaction. If the TransactionStatus one of these webhook events is SUCCESS, ignore the other webhook event and mark the order as paid in your system.

  1. REFUND STATUS CHANGED:
    This will notify your system of the refund status (refunded, canceled). You will find the needed information about this event in the Refund Data Model section.
  2. BALANCE TRANSFERRED:
    This will notify your system of the new deposit whenever Myfatoorah transfers the balance to your bank account or your suppliers. You will find the needed information about this event in the Balance Transferred Data Model section.
  3. SUPPLIER STATUS CHANGED:
    This will notify your system of the supplier account status (approved, rejected). You will find the needed information about this event in the Supplier Data Model section.
  4. RECURRING UPDATES:
    This will send a webhook event for every deduction attempt on a Recurring Payment. You will find the needed information about this event in the Recurring Data Model section.