> For the complete documentation index, see [llms.txt](https://developers.klasha.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.klasha.com/~/revisions/H5FGFkMO860BT4FVTiB5/misc/webhook.md).

# Webhook

If you have webhook notifications set up on your dashboard, we will send you updates for different activities, samples of which can be found below:

#### Transaction types

* [x] Collections

{% tabs %}
{% tab title="charge.completed (successful)" %}

```json
{
  "event": "charge.completed",
  "data": {
    "createdAt": "2021-11-18T15:23:16.781",
    "narration": "CARD Transaction ",
    "destinationCurrency": "NGN",
    "sourceAmount": 100,
    "sourceCurrency": "NGN",
    "tnxRef": "6e003f69-55e3-4117-aa7a-f4259ad227ae",
    "status": "successful",
    "destinationAmount": 100,
    "customer": {
      "id": 13,
      "name": "Demo Tester",
      "email": "demo@tester.com",
      "phone": 07000000001,
      "createdAt": "2021-07-20 10:28:43",
      "updatedAt": "2021-07-20 10:28:43"
    }
  }
}
```

{% endtab %}

{% tab title="charge.completed (failed)" %}

```json
{
  "event": "charge.completed",
  "data": {
    "createdAt": "2021-11-18T15:23:16.781",
    "narration": "CARD Transaction ",
    "destinationCurrency": "NGN",
    "sourceAmount": 100,
    "sourceCurrency": "NGN",
    "tnxRef": "6e003f69-55e3-4117-aa7a-f4259ad227ae",
    "status": "failed",
    "destinationAmount": 100,
    "customer": {
      "id": 13,
      "name": "Demo Tester",
      "email": "demo@tester.com",
      "phone": 07000000001,
      "createdAt": "2021-07-20 10:28:43",
      "updatedAt": "2021-07-20 10:28:43"
    }
  }
}
```

{% endtab %}
{% endtabs %}

* [x] Payout

{% tabs %}
{% tab title="payout (successful)" %}

```json
{
  "data": {
    "reference": "kbtr-3857-011-null-166993253331236",
    "createdAt": "2023-03-28T23:01:45.336",
    "amount": 1000,
    "accountName": "Pastor Bright",
    "narration": "certification",
    "name": "Steph and sons",
    "currency": "NGN",
    "bankName": "ACCESS BANK NIGERIA",
    "accountNumber": "0690000032",
    "status": "successful"
  },
  "event": "payout"
}
```

{% endtab %}

{% tab title="payout (failed)" %}

```json
{
  "data": {
    "reference": "kbtr-3857-011-null-166993253331236",
    "createdAt": "2023-03-28T23:01:45.336",
    "amount": 1000,
    "accountName": "Pastor Bright",
    "narration": "certification",
    "name": "Steph and sons",
    "currency": "NGN",
    "bankName": "ACCESS BANK NIGERIA",
    "accountNumber": "0690000032",
    "status": "failed"
  },
  "event": "payout"
}
```

{% endtab %}
{% endtabs %}

* [x] Refund

{% tabs %}
{% tab title="refund.completed (successful)" %}

```json
{
  "event": "refund.completed",
  "data": {
    "createdAt": "2021-11-18T15:23:16.781",
    "refundType": "partial",
    "refundRef": "6b691e37-02ae-4ccc-859d-1d10e53eeabd",
    "amount": 100,
    "completeMessage": "",
    "tnxRef": "6e003f69-55e3-4117-aa7a-f4259ad227ae",
    "status": "successful",
    "customer": {
      "id": 13,
      "name": "Demo Tester",
      "email": "demo@tester.com",
      "phone": 07000000001,
      "createdAt": "2021-07-20 10:28:43",
      "updatedAt": "2021-07-20 10:28:43"
    }
  }
}
```

{% endtab %}

{% tab title="refund.completed (failed)" %}

```json
{
  "event": "refund.completed",
  "data": {
    "createdAt": "2021-11-18T15:23:16.781",
    "refundType": "partial",
    "refundRef": "6b691e37-02ae-4ccc-859d-1d10e53eeabd",
    "amount": 100,
    "completeMessage": "",
    "tnxRef": "6e003f69-55e3-4117-aa7a-f4259ad227ae",
    "status": "failed",
    "customer": {
      "id": 13,
      "name": "Demo Tester",
      "email": "demo@tester.com",
      "phone": 07000000001,
      "createdAt": "2021-07-20 10:28:43",
      "updatedAt": "2021-07-20 10:28:43"
    }
  }
}
```

{% endtab %}
{% endtabs %}

### Resend Webhook

> <mark style="color:yellow;">POST</mark> <mark style="color:red;">`{{env_url}}`</mark>`/nucleus/tnx/webhook?reference=`<mark style="color:red;">`{{tx_ref}}`</mark>

This endpoint allows you to resend webhooks from failed sending queues to your server.

You’d need to pass your merchant public key in the request header (`x-auth-token`). This can be obtained from your merchant dashboard → Settings → Generate API keys → **Merchant public key.**

**Headers**

| Name          | Value                                            |
| ------------- | ------------------------------------------------ |
| Content-Type  | `application/json`                               |
| x-auth-token  | merchant public key                              |
| Authorization | Bearer <mark style="color:red;">{{token}}</mark> |

#### Query Params

```json
"tx_ref": the reference used when initiating the transaction
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "message": "webhook sent for reference {{tx_ref}}",
    "error": null,
    "data": null
}
```

{% endtab %}
{% endtabs %}
