API Reference

To start with the Fawaterk Webhook service, you can follow these steps to complete your integration :

1- Log in to your portal account and go to Integration
2- Add your link that web hook will send data to

Important Notes

Paid transactions webhook:

1 - This web hook only revoke when invoice status changed to Paid
2- In case you want to receive web hook data in json format be sure that your url has _json
ex: https://yourwebsite.com/webhook_json

WebHook Body (Default) :

{ "api_key": "d83a5d07aaeb8442dcbe259e6dae80a3f2e21a3a581e1a5acd", "invoice_key": "69zpnFIcIPYNBwG", "invoice_id": 1000430, "payment_method": "Fawry", "invoice_status": "paid", "pay_load": null, "referenceNumber": "982443480" }

WebHook Body (New version more reliable, please contact our support to apply) :

{ "hashKey": "f59665d40772c9c47156cd0bff453b85e489306e849c27eea2", "invoice_key": "69zpnFIcIPYNBwG", "invoice_id": 1000430, "payment_method": "Fawry", "invoice_status": "paid", "pay_load": null or Obj, "referenceNumber": "982443480" }

hashKey here is used to validate the callback is from Fawaterak side

HASH-KEY:

hashKey generation uses HMAC SHA256 Crypto mechanism, you should generate the hash from your backend and is implemented as explained below to compare it with ours:

function generateHashKey($data){ $secretKey = "FAWATERAK_VENDOR_KEY"; $queryParam = "InvoiceId=response.invoice_id&InvoiceKey=response.invoice_key&PaymentMethod=response.payment_method"; $hash = hash_hmac( 'sha256' , $queryParam , $secretKey ,false); return $hash; }

cancel transactions (Fawry, Aman, Masary) webhook:

1 - This webhook only revoke when Fawry/Aman/Masary transaction gets expired.

WebHook Body :

{ "hashKey": "f59665d40772c9c47156cd0bff453b85e489306e849c27eea2", "referenceId": "123456", "status": "EXPIRED", "paymentMethod": "Fawry", "pay_load": null or Obj }

hashKey here is used to validate the callback is from Fawaterak side

HASH-KEY:

hashKey generation uses HMAC SHA256 Crypto mechanism, you should generate the hash from your backend and is implemented as explained below to compare it with ours:

function generateHashKey($data){ $secretKey = "FAWATERAK_VENDOR_KEY"; $queryParam = "referenceId=response.referenceId&PaymentMethod=response.paymentMethod"; $hash = hash_hmac( 'sha256' , $queryParam , $secretKey ,false); return $hash; }