Webhook V1
Introduction
Webhook V1 allows you to asynchronously update your system with changes occurring in your MyFatoorah account.
In Webhook V1, MyFatoorah will attempt to send the webhook event up to four times if a Success status code is not received from your side. The retries are scheduled with a 10-second interval between each attempt.
To ensure the security of the webhook events, we highly recommend enabling the Webhook Secret Key. This key is included in the headers of the webhook event as the value of the myfatoorah-signature
header, providing 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.
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 Parameter | Type | Description |
---|---|---|
EventType | number | 1 For Transaction Status Changed 2 For Refund Status Changed 3 For Balance Transferred 4 For Supplier Status Changed 5 For Recurring Status Changed |
Event | string | TransactionsStatusChanged RefundStatusChanged BalanceTransferred SupplierStatusChanged |
DateTime | datetime | The event date time format "ddMMyyyyHHmmss" |
CountryIsoCode | string | The country for the event portal with 3 alpha ISO format |
Data | DataModel | The event data model and it depends on the event type. see describtion below. |
For now, we support four types of events:
- Transaction Status Changed:
This will notify your system of the transaction status (success, failed). You will find the needed information about this event in the Transaction 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.
- 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. - Balance Transferred:
This will notify your system of the new deposit whenever Myfatoorah transferred the balance to your bank account. You will find the needed information about this event in the Deposit Data Model section. - 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. - Recurring Status Changed:
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.
Updated about 17 hours ago