> For the complete documentation index, see [llms.txt](https://docs.qwaap.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.qwaap.com/webhooks-and-redirects/webhooks.md).

# Webhooks

We notify your web applications whenever invoice payment statuses change through web-hooks. We expect you to set your web-hook URL under your merchant account Profile settings by now.

#### Introduction

{% hint style="info" %}

### Webhook

Is also know as web callback or HTTP push API. It's a way for an app to provide other applications with real-time information or data.&#x20;

The data can also be referred to as webhook or callback data.

The HTTP URL reserved to receive the data from another application(Qwaap Wallet) is called a webhook or callback URL

Therefore webhook and callback can be used inter-changeably&#x20;

### NOTES

1. All `collection` and `payout` transaction `callbacks` will be sent to the URL set as the `webhook url` under your merchant account API settings.<br>
2. A **`POST`** request with **`json data`** will be sent to your `webhook url`<br>
3. We require that you provide a secure `webhook url`. Therefore only, `https` URLs can be set or notified.<br>
4. You will need to acknowledge receipt of the callback by responding with the HTTP status code **`200`**. Otherwise, we might keep calling your webhook URL at an interval of 10 minutes for 3 days.<br>
5. To ensure that the callback data sent to your `webhook URL` comes from our servers, you need to set a `callback hash` under the `Api Settings`.<br>
6. We will include a header called, rsa\_signature and the hmac-signature in the request sent to the callback URL as shown below. You can use either of the two.

<img src="https://2049792905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fvp4auR5FdVzNOXBHULF2%2Fuploads%2FP3txfQKllsV2DBGluYjC%2Fwebhook.png?alt=media&amp;token=ec997761-92c6-45b6-993d-78c488fcf4c6" alt="" data-size="original">
{% endhint %}

### Signature Validation

You can use any of the methods below.

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td>HMAC Signature Verification</td><td></td><td></td><td><a href="/webhooks-and-redirects/webhooks/hmac-signature-verification.md">HMAC Signature Verification</a></td></tr><tr><td>RSA Signature Verification</td><td></td><td></td><td><a href="/webhooks-and-redirects/webhooks/rsa-signature-verification.md">RSA Signature Verification</a></td></tr></tbody></table>

### Responding to webhooks <a href="#responding-to-webhooks" id="responding-to-webhooks"></a>

* We will stop calling you back if your callback URL responds with “HTTP status codes” below;

| Code  | Description             |
| ----- | ----------------------- |
| `200` | - OK                    |
| `400` | - Bad Request           |
| `401` | - Unauthorised          |
| `403` | - Forbidden             |
| `422` | - Unprocessable entity. |

### Rejecting webhook <a href="#rejecting-webhook" id="rejecting-webhook"></a>

* In a scenario where the transaction cannot be processed or you cannot give value, respond with HTTP codes below;

| Code  | Description                                                                                                                                      |
| ----- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `400` | <p>- Bad Request.<br>- e.g when there’s a missing parameter</p>                                                                                  |
| `422` | <p>- Unprocessable entity.<br>- e.g when the request is fine but you cannot complete it because the amount does not match what you expected.</p> |

{% hint style="danger" %}
**KEYNOTE**

Always verify the, **`amount`** to make sure it matches what is meant to be **`paid`** before giving value to the customer.
{% endhint %}

{% tabs %}
{% tab title="Sample Collection IPN Data" %}

```javascript
{
    "id": 1741,
    "request_amount": 10000,
    "request_currency": "NGN",
    "transaction_fee": 2000,
    "total_credit": 8000,
    "invoice_number": "QINVQF9VEWHJVLYSAA2Z",
    "merchant_reference": "M10010400",
    "payment_status": "PAID",
    "transaction_type": "COLLECTION",
    "status_message": "Invoice payment successful"
}
```

{% endtab %}
{% endtabs %}
