PayAgency Logo

Webhooks

Webhooks allow you to receive real-time notifications about the status of transactions processed through the payment gateway. Whenever a transaction reaches a final status (e.g., `SUCCESS`, `FAILED`, or `BLOCKED`), the system sends a webhook to the URL configured by the user.

Webhook Workflow

  1. Triggering the Webhook:
    A webhook is triggered when a transaction reaches one of the following statuses:

    • SUCCESS: The transaction is successfully processed.
    • FAILED: The transaction failed due to an issue (e.g., invalid card details or insufficient funds).
    • BLOCKED: The transaction is blocked due to security concerns or policy violations.
  2. Resending Webhooks:
    If the webhook fails (e.g., due to server unavailability or timeout), the system retries the webhook up to 3 times at predefined intervals. After the third failure, the webhook is marked as undelivered.

  3. Security and Hash Validation:
    Users can set their own secret or unique key for enhanced security.The system will sent in the header fs-webhook-hash. This allows users to verify the authenticity of the webhook.


Webhook Headers

The webhook request includes the following headers:

Header NameDescription
Content-TypeSpecifies the content type. Always set to application/json.
fs-webhook-hashA hash generated using the user's encryption key to verify webhook authenticity.

Webhook Payload

The webhook payload contains details about the transaction and its status. Below is the JSON payload format:

{
    "status": "SUCCESS",
    "message": "Transaction processed successfully!.",
    "data": {
        "amount": 100,
        "currency": "GBP",
        "order_id": null,
        "transaction_id": "PA7663692011084535",
        "customer": {
            "first_name": "James",
            "last_name": "dean",
            "email": "james@gmail.com"
        },
        "refund": {
            "status": false,
            "refund_date": null
        },
        "chargeback": {
            "status": false,
            "chargeback_date": null
        }
    }
}

On this page