# 7. Query Transaction Status

## Key Definitions

**`LIVE baseUrl`**: [https://kola.vpay.africa](https://kola.vpay.africa/)

**`SANDBOX baseUrl`**: <https://zander.vpay.africa>

**`accessToken`**: JWT token generated from the login endpoint

There are two endpoints involved as described below.

## (a) login

Use this endpoint to authenticate your account and obtain a JWT **accessToken** for use in subsequent endpoints

{% hint style="danger" %}
This endpoint is throttled to 1 request every 270000 milliseconds.
{% endhint %}

Request

<table><thead><tr><th width="204">Method</th><th>URL</th></tr></thead><tbody><tr><td><mark style="color:yellow;"><strong>POST</strong></mark></td><td><mark style="color:blue;"><strong>{{baseUrl}}</strong>/api/service/v1/query/merchant/login</mark></td></tr></tbody></table>

<table><thead><tr><th width="206">Header</th><th width="373">Value</th><th></th></tr></thead><tbody><tr><td>Content-Type</td><td>application/json</td><td></td></tr><tr><td>publicKey</td><td>{{publicKey}}</td><td>The public key supplied by your account manager.</td></tr></tbody></table>

<table><thead><tr><th width="208">Request Body</th><th width="371">Description</th><th></th></tr></thead><tbody><tr><td>username</td><td>Merchant email or phone number</td><td>mandatory</td></tr><tr><td>password</td><td>Merchant password</td><td>mandatory</td></tr></tbody></table>

Response Payload Sample

```
{
  "status": true,
  "message": "Here. Your token.",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InFhMTAxX3Ntb290aEBnaXZtYWlsLmNvbSIsImZpcnN0bmFtZSI6IlNtb290aCIsImxhc3RuYW1lIjoiVGVzdCIsImJ1c2luZXNzbmFtZSI6IlNtb290aCBUZXN0IC0gVGVzdCBTbGF5IiwiYnVzaW5lc3NpZCI6IjY0NmIzMThkYTU3MzdjNDQ1NmY4ODkzYiIsInB1YmxpY2tleSI6IjMwMjNmZjYwLWIxODItNGNjYi1hNTk5LThkZTRjNzRlMjkxMCIsInZlcnNpb24iOjEsInVzZXIiOiI2NDZiMzE4Y2E1NzM3YzQ0NTZmODg5MGUiLCJyb2xlIjoibWVyY2hhbnQiLCJpYXQiOjE2ODU0ODc3NDAsImV4cCI6MTg0MzE2Nzc0MH0.OEUYoAKRiMoU-fjy4kx0FZF1JJPT57BVHwCC-OC9aIE",
  "role": "merchant",
  "firstname": "Smooth",
  "adminname": "Admin",
  "lastname": "Test",
  "businessname": "Smooth Admin - Test Slay",
  "shortid": "4GOL",
  "merchants": [
    {
      "businessid": "646b318da5737c4456f8893b",
      "shortid": "4GOL",
      "businessname": "Smooth Admin - Test Slay",
      "contactfirstname": "Smooth",
      "contactlastname": "Admin",
      "publickey": "3023ff60-b182-4ccb-a599-8de4c74e2910",
      "address": "This Is A Test Address",
      "nuban": "4600000022"
    }
  ],
  "lastlogin": "2023-12-30T17:27:02.101Z"
}
```

## (b) query transaction status

Use this endpoint to query the status of your transaction using your previously generated transaction reference

{% hint style="danger" %}
This endpoint is throttled to 1 request every 1000 milliseconds.
{% endhint %}

Request

<table><thead><tr><th width="210">Method</th><th>URL</th></tr></thead><tbody><tr><td><mark style="color:yellow;"><strong>POST</strong></mark></td><td><mark style="color:blue;"><strong>{{baseUrl}}</strong>/api/v1/webintegration/query-transaction</mark></td></tr></tbody></table>

<table><thead><tr><th width="212">Header</th><th width="343">Value</th><th></th></tr></thead><tbody><tr><td>Content-Type</td><td>application/json</td><td></td></tr><tr><td>publicKey</td><td>{{publicKey}}</td><td></td></tr><tr><td>b-access-token</td><td>{{accessToken}}</td><td>Use the <strong>token</strong> value that was provided in the response payload from the login endpoint above</td></tr></tbody></table>

<table><thead><tr><th width="213">Request Body</th><th width="345">Description</th><th></th></tr></thead><tbody><tr><td>transactionRef</td><td>Your unique transaction reference</td><td>case sensitive and mandatory</td></tr></tbody></table>

Response Payload Sample

```
{
  "data": {
    "paymentstatus": "paid",
    "transactionref": "ref-647635b3ddcce187361685468595",
    "paymentmethod": "bank",
    "orderamount": 990,
    "originalamount": 0,
    "reversed": false
  }
}
```
