# 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:

####

* [x] Collections

{% tabs %}
{% tab title="charge.completed" %}

```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 (paylink)" %}

```json
{
    "data": {
        "createdAt": "2024-08-21T12:03:46.728",
        "subMerchantId": "sub-merchant_12",
        "paylinkId": "8406d382-8443-4c65-aaf2-6dc3721c85b4",
        "narration": "Business wallet popup payment",
        "destinationCurrency": "NGN",
        "sourceAmount": 1500.00,
        "sourceCurrency": "NGN",
        "tnxRef": "paylink-f66b115c-4733-4b2c-88f9-085517c1dba7",
        "status": "successful",
        "destinationAmount": 1500.0,
        "customer": {
            "id": 13,
            "name": "Steph Oj",
            "email": "stephen@klasha.com",
            "phone": null,
            "createdAt": "2021-07-20T10:28:43.820",
            "updatedAt": "2021-07-20T10:28:43.820"
        }
    },
    "event": "charge.completed"
}
```

{% 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 %}
