> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.vtuagent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.vtuagent.com/_mcp/server.

# Query Transaction Status

POST https://api.vtuagent.com/v1/transaction/status
Content-Type: application/json

Returns the current state of a transaction you created, looked up by your `request_ref`. Use it to resolve any `pending` purchase.

Calling this endpoint also re-sends a `transaction.requery` webhook (if you have a webhook URL configured) carrying the same status.

`transaction_type` is one of `AIRTIME`, `DATA`, `CABLE_TV`, `ELECTRICITY`. `previous_balance` / `new_balance` are the wallet balance before and after the debit.

| HTTP | `status` | `status_code` | Meaning |
|---|---|---|---|
| 200 | `successful` | 200 | Transaction completed |
| 202 | `pending` | 202 | Still processing — poll again or wait for your webhook |
| 400 | `error` | — | Bad payload or missing `request_ref` |
| 401 | — | — | Missing, invalid or revoked API key |
| 403 | `error` | — | Reference exists but belongs to another account (body identical to 404) |
| 404 | `error` | — | No transaction with that reference |
| 424 | `failed` | 424 | Transaction failed — wallet was refunded |

Reference: https://docs.vtuagent.com/api-reference/vtu-agent-consumable-api/transaction/query-transaction-status

## Authentication

- `Authorization` header (bearer token, required) — API key issued from the VTUAgent dashboard, sent as `Authorization: Bearer {your_api_key}`.

## Request

### Body (application/json)

This endpoint expects a TransactionStatusRequest.

- `request_ref` (string, required) — The reference you sent when purchasing.

## Response

### 200

Transaction completed

- `status` (enum, required)
  - Allowed values: `successful`, `pending`, `failed`
- `status_code` (enum, required) — Always equals the HTTP status.
  - Allowed values: `200`, `202`, `424`
- `message` (string, required)
- `reference` (string, required)
- `data` (TransactionStatusResponseData, required)

### 202

Still processing — poll again or wait for your webhook

- `status` (enum, required)
  - Allowed values: `successful`, `pending`, `failed`
- `status_code` (enum, required) — Always equals the HTTP status.
  - Allowed values: `200`, `202`, `424`
- `message` (string, required)
- `reference` (string, required)
- `data` (TransactionStatusResponseData, required)

## Errors

### 400 Bad Request Error

Invalid payload or missing request_ref

- `status` (enum, required)
  - Allowed values: `error`
- `message` (string, required)
- `error` (string, optional) — Validator detail, present only on validation failures.

### 401 Unauthorized Error

Missing, invalid or revoked API key. Note: this envelope has no `status` field.

- `message` (string, required)
- `error` (string, required)

### 403 Forbidden Error

Reference belongs to another account

- `status` (enum, required)
  - Allowed values: `error`
- `message` (string, required)
- `error` (string, optional) — Validator detail, present only on validation failures.

### 404 Not Found Error

No transaction with that reference

- `status` (enum, required)
  - Allowed values: `error`
- `message` (string, required)
- `error` (string, optional) — Validator detail, present only on validation failures.

### 424 Failed Dependency Error

Transaction failed — wallet was refunded

- `status` (enum, required)
  - Allowed values: `successful`, `pending`, `failed`
- `status_code` (enum, required) — Always equals the HTTP status.
  - Allowed values: `200`, `202`, `424`
- `message` (string, required)
- `reference` (string, required)
- `data` (TransactionStatusResponseData, required)

## Types

### TransactionStatusResponseData

- `transaction_type` (enum, optional)
  - Allowed values: `AIRTIME`, `DATA`, `CABLE_TV`, `ELECTRICITY`
- `amount` (string, optional)
- `previous_balance` (string, optional)
- `new_balance` (string, optional)
- `description` (string, optional)
- `created_at` (datetime, optional)

## Examples

**Request**

```json
{
  "request_ref": "9f1c2a4e-7b3d-4c8e-9a1f-2b3c4d5e6f70"
}
```

**Response**

```json
{
  "status": "successful",
  "status_code": 200,
  "message": "Transaction is successful",
  "reference": "9f1c2a4e-7b3d-4c8e-9a1f-2b3c4d5e6f70",
  "data": {
    "transaction_type": "AIRTIME",
    "amount": "100",
    "previous_balance": "5000",
    "new_balance": "4900",
    "description": "Airtime Purchase for 08012345678",
    "created_at": "2026-09-13T10:15:42.123456Z"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.vtuagent.com/v1/transaction/status"

payload = { "request_ref": "9f1c2a4e-7b3d-4c8e-9a1f-2b3c4d5e6f70" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.vtuagent.com/v1/transaction/status';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"request_ref":"9f1c2a4e-7b3d-4c8e-9a1f-2b3c4d5e6f70"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.vtuagent.com/v1/transaction/status"

	payload := strings.NewReader("{\n  \"request_ref\": \"9f1c2a4e-7b3d-4c8e-9a1f-2b3c4d5e6f70\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.vtuagent.com/v1/transaction/status")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"request_ref\": \"9f1c2a4e-7b3d-4c8e-9a1f-2b3c4d5e6f70\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.vtuagent.com/v1/transaction/status")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"request_ref\": \"9f1c2a4e-7b3d-4c8e-9a1f-2b3c4d5e6f70\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.vtuagent.com/v1/transaction/status', [
  'body' => '{
  "request_ref": "9f1c2a4e-7b3d-4c8e-9a1f-2b3c4d5e6f70"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.vtuagent.com/v1/transaction/status");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"request_ref\": \"9f1c2a4e-7b3d-4c8e-9a1f-2b3c4d5e6f70\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["request_ref": "9f1c2a4e-7b3d-4c8e-9a1f-2b3c4d5e6f70"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.vtuagent.com/v1/transaction/status")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```