# VA balance and statement

### Summary

These APIs give Klasha’s merchants the ability to retrieve the balance of their Virtual Account as well as the statement of their transactions.

### API specifications

**Before you begin!**

{% stepper %}
{% step %}
**Generate a bearer token**

Use the token request [endpoint](https://developers.klasha.com/~/revisions/LgPYv1wt83TA5LzyGVuI/overview/token-generation) to generate a bearer token and pass in the header of the api calls below.
{% endstep %}

{% step %}
**Retrieve your merchant public key**

Find your keys on the Klasha dashboard → Settings → Generate API keys → Merchant public key (as shown below).&#x20;

<img src="https://257545343-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FNw4nU37LIEg41plxXG5u%2Fuploads%2FvBXI8QATrncq17zlRm1P%2Fdashboad-klasha-settings.png?alt=media&#x26;token=1ebaf2b3-7e99-4490-9ede-a660c8d0035c" alt="" data-size="original">
{% endstep %}
{% endstepper %}

## Get Virtual Account Balance

> <mark style="color:blue;">**GET**</mark> - <mark style="color:$primary;">`{{env_url}}/nucleus/virtual/account/collections/business/`</mark>

NB: You’d need to pass your merchant public key in the header as the x-auth-token and bearer token as the Authorization.

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| x-auth-token<mark style="color:red;">\*</mark>  | String | merchant public key |
| Authorization<mark style="color:red;">\*</mark> | String | bearer \<token>     |

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

```json
{
    "message": "success",
    "error": null,
    "data": {
        "virtualAccountCollectionSettlement": 100.00,
        "virtualAccountCollectionsBalance": 200.00
    }
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

```json
{
    "message": "A human readable error message",
    "error": "Bad Request",
    "data": null
}
```

{% endtab %}
{% endtabs %}

## Retrieve Transaction Statements

> <mark style="color:yellow;">**POST**</mark> - <mark style="color:$primary;">`{{env_url}}/nucleus/tnx/paginated/filter/v2`</mark>

NB: You’d need to pass the merchant public key in the header as the x-auth-token.

#### Headers

| Name                                           | Type   | Description         |
| ---------------------------------------------- | ------ | ------------------- |
| x-auth-token<mark style="color:red;">\*</mark> | String | merchant public key |

#### Request Body

* The request body can be a combination of the filters below (all or just 1 or 2)
* When you send an empty request body, you get all your transactions.

| Name     | Type   | Description                  |
| -------- | ------ | ---------------------------- |
| currency | String | transaction currency         |
| status   | String | transaction status           |
| tnxRef   | String | unique transaction reference |

{% tabs %}
{% tab title="200: OK " %}
{% code overflow="wrap" %}

```json
{
    "message": "success",
    "error": null,
    "data": {
        "pageNo": 1,
        "totalPages": 1,
        "totalCount": 1,
        "transactions": [
            {
                "transaction": {
                    "status": "successful",
                    "virtualAccountNumber": "000000001",
                    "email": "tester@email.com",
                    "currency": "NGN",
                    "tnxRef": "e7ef0a9a-8898-4850-9290-2b28ece057fe",
                    "sourceCurrency": "NGN",
                    "paymentType": "BANK_TRANSFER",
                    "channel": "woo",
                    "previousBalance": 1003.02,
                    "amountCredited": 100,
                    "amountCollected": 200,
                    "newBalance": 1103.02,
                    "settledCurrency": "NGN",
                    "createdAt": "2023-01-01 01:01:00",
                    "payerDetails": {
                        "bank": "Wema Bank",
                        "accountName": "Tester Demo",
                        "accountNumber": "0000000022"
                    }
                }
            }
        ]
    }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}
