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

# Purchase Utility Bill

POST https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility
Content-Type: application/json

Pays a utility bill (e.g. electricity) for a previously verified meter. On success, `data.token` / `data.unit` carry the prepaid token, if applicable.

**Body (JSON):**

| Field                 | Type    | Rules                                                                                   |
| --------------------- | ------- | --------------------------------------------------------------------------------------- |
| `idempotencyKey`      | string  | required, 4–250 chars                                                                   |
| `meterVerificationId` | string  | required; unused ID from **Verify Entity** for a Utility category                       |
| `amount`              | number  | required, ₦100–₦50,000                                                                  |
| `vendType`            | string  | `PREPAID` or `POSTPAID`; **required** by the endpoint and must match the verified meter |
| `settlementId`        | integer | required                                                                                |

The meter number comes from the verification. On SUCCESS, `data.token` is the prepaid token and `data.unit` the units (kWh) as returned by the provider (may be absent/`null` for postpaid). The *duplicate* response for this endpoint returns the full stored transaction record (different shape from the other purchase endpoints).

**Purchase outcomes** (shared flow):

* **200** `data.status: "SUCCESS"` — delivered.
* **200** `data.status: "PENDING"` with message `... purchase is being confirmed. Do not retry; check the transaction status.` — provider outcome unknown; you have been debited and **not** refunded. Poll **Fetch Single VTU Transaction**; do not resend.
* **400** `... purchase failed. Your balance has been refunded.` — provider definitively rejected; safe to retry with a **new** `idempotencyKey`.
* **409** `Duplicate request in flight` — another request with the same `idempotencyKey` is being processed.
* **200** `Duplicate request — returning existing transaction` — the `idempotencyKey` was already used; the original transaction is returned and nothing is charged.

Your settlement balance must be **strictly greater** than the amount (`balance <= amount` is rejected as insufficient).

**Error format:** body validation failures (Joi) return `{ "status": "error", "message": "Validation error", "details": [ ... ] }`; all other errors return `{ "success": false, "message": "..." }`. Money fields (`amount`, `fee`) are Prisma Decimals and are serialized as **strings** (e.g. `"1000"`).

Reference: https://docs.shimi.cash/api-reference/shimi-api/airtime-data-bills-vtu/purchase-utility-bill

## Authentication

- `Authorization` header (bearer token, required) — Access token from Generate Access Token (valid 15 minutes).

## Request

### Body (application/json)

This endpoint expects an object.

- `idempotencyKey` (string, optional)
- `meterVerificationId` (string, optional)
- `settlementId` (integer, optional)
- `amount` (integer, optional)
- `vendType` (string, optional)

## Response

### 200

Success / Pending (being confirmed) / Duplicate (existing transaction)

- `success` (boolean, optional)
- `data` (VtuPurchaseUtilityPostResponsesContentApplicationJsonSchemaData, optional)
- `message` (string, optional)

## Errors

### 400 Bad Request Error

Failed (refunded) / Insufficient balance / Verification used / vendType mismatch / Validation error / Settlement not found

- `success` (boolean, optional)
- `message` (string, optional)
- `status` (string, optional)
- `details` (list of string, optional)

### 401 Unauthorized Error

Unauthorized

- `message` (string, optional)

### 403 Forbidden Error

Invalid or expired access token / KYB not approved / Account deactivated

- `message` (string, optional)
- `code` (string, optional)
- `kybStatus` (string, optional)

### 409 Conflict Error

Conflict

- `success` (boolean, optional)
- `message` (string, optional)

## Types

### VtuPurchaseUtilityPostResponsesContentApplicationJsonSchemaData

- `transactionId` (string, optional)
- `status` (string, optional)
- `type` (string, optional)
- `amount` (string, optional)
- `createdAt` (string, optional)
- `token` (string, optional)
- `unit` (string, optional)
- `id` (string, optional)
- `companyId` (string, optional)
- `vtuServiceCategoryId` (string, optional)
- `productId` (string, optional, nullable)
- `settlementId` (integer, optional)
- `phoneNumber` (string, optional, nullable)
- `cardNumber` (string, optional, nullable)
- `entityNumber` (string, optional)
- `vendType` (string, optional)
- `idempotencyKey` (string, optional)
- `externalReference` (string, optional)
- `providerReference` (string, optional)
- `providerResponse` (VtuPurchaseUtilityPostResponsesContentApplicationJsonSchemaDataProviderResponse, optional)
- `fee` (string, optional)
- `narration` (string, optional)
- `updatedAt` (string, optional)
- `meterVerificationId` (string, optional, nullable)

### VtuPurchaseUtilityPostResponsesContentApplicationJsonSchemaDataProviderResponse

- `statusCode` (integer, optional)
- `message` (string, optional)
- `data` (VtuPurchaseUtilityPostResponsesContentApplicationJsonSchemaDataProviderResponseData, optional)

### VtuPurchaseUtilityPostResponsesContentApplicationJsonSchemaDataProviderResponseData

- `reference` (string, optional)
- `utilityToken` (string, optional)
- `tokenValue` (string, optional)

## Examples

### 200 Success

**Response**

```json
{
  "success": true,
  "data": {
    "transactionId": "cm2z9h1j20013vtx7ij89kl0",
    "status": "SUCCESS",
    "type": "UTILITY",
    "amount": "5000",
    "createdAt": "2026-10-04T10:22:31.418Z",
    "token": "5719-3824-0612-9947-3058",
    "unit": "68.4"
  }
}
```

**SDK Code**

```python 200 Success
import requests

url = "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility"

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript 200 Success
const url = 'https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

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

```go 200 Success
package main

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

func main() {

	url := "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility"

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

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

url = URI("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

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

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

HttpResponse<String> response = Unirest.post("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp 200 Success
using RestSharp;

var client = new RestClient("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift 200 Success
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```

### 200 Pending (being confirmed)

**Response**

```json
{
  "success": true,
  "data": {
    "transactionId": "cm2z9h1j20013vtx7ij89kl0",
    "status": "PENDING",
    "type": "UTILITY",
    "amount": "5000",
    "createdAt": "2026-10-04T10:22:31.418Z"
  },
  "message": "Utility purchase is being confirmed. Do not retry; check the transaction status."
}
```

**SDK Code**

```python 200 Pending (being confirmed)
import requests

url = "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility"

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript 200 Pending (being confirmed)
const url = 'https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

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

```go 200 Pending (being confirmed)
package main

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

func main() {

	url := "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility"

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

```ruby 200 Pending (being confirmed)
require 'uri'
require 'net/http'

url = URI("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

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

```java 200 Pending (being confirmed)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php 200 Pending (being confirmed)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp 200 Pending (being confirmed)
using RestSharp;

var client = new RestClient("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift 200 Pending (being confirmed)
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```

### 200 Duplicate (existing transaction)

**Response**

```json
{
  "success": true,
  "data": {
    "status": "SUCCESS",
    "type": "UTILITY",
    "amount": "5000",
    "createdAt": "2026-10-04T10:22:31.418Z",
    "id": "cm2z9h1j20013vtx7ij89kl0",
    "companyId": "cm0c1d2e30000cmp4xy56za7",
    "vtuServiceCategoryId": "cm1v1b2c30021ikd7ef34gh5",
    "productId": null,
    "settlementId": 1,
    "phoneNumber": null,
    "cardNumber": null,
    "entityNumber": "45031234567",
    "vendType": "PREPAID",
    "idempotencyKey": "7f3c2a9e-4b1d-4e8a-9c2f-1a5b6d7e8f90",
    "externalReference": "VTU-8F2A9C41D7E04B6A93C1",
    "providerReference": "SUDO-VAS-20261004102231-77812",
    "providerResponse": {
      "statusCode": 200,
      "message": "Transaction successful",
      "data": {
        "reference": "SUDO-VAS-20261004102231-77812",
        "utilityToken": "5719-3824-0612-9947-3058",
        "tokenValue": "68.4"
      }
    },
    "fee": "0",
    "narration": "Utility - Ikeja Electric (IKEDC) - 45031234567",
    "updatedAt": "2026-10-04T10:22:34.902Z",
    "meterVerificationId": null
  },
  "message": "Duplicate request — returning existing transaction"
}
```

**SDK Code**

```python 200 Duplicate (existing transaction)
import requests

url = "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility"

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript 200 Duplicate (existing transaction)
const url = 'https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

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

```go 200 Duplicate (existing transaction)
package main

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

func main() {

	url := "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility"

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

	req.Header.Add("Authorization", "Bearer <token>")

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

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

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

}
```

```ruby 200 Duplicate (existing transaction)
require 'uri'
require 'net/http'

url = URI("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'

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

```java 200 Duplicate (existing transaction)
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php 200 Duplicate (existing transaction)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp 200 Duplicate (existing transaction)
using RestSharp;

var client = new RestClient("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift 200 Duplicate (existing transaction)
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```

### Airtime, Data & Bills (VTU)_purchaseUtilityBill_example

**Request**

```json
{
  "idempotencyKey": "{{$guid}}",
  "meterVerificationId": "{{meter_verification_id}}",
  "settlementId": 1,
  "amount": 5000,
  "vendType": "PREPAID"
}
```

**Response**

```json
{
  "success": true,
  "data": {
    "transactionId": "cm2z9h1j20013vtx7ij89kl0",
    "status": "SUCCESS",
    "type": "UTILITY",
    "amount": "5000",
    "createdAt": "2026-10-04T10:22:31.418Z",
    "token": "5719-3824-0612-9947-3058",
    "unit": "68.4"
  }
}
```

**SDK Code**

```python Airtime, Data & Bills (VTU)_purchaseUtilityBill_example
import requests

url = "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility"

payload = {
    "idempotencyKey": "{{$guid}}",
    "meterVerificationId": "{{meter_verification_id}}",
    "settlementId": 1,
    "amount": 5000,
    "vendType": "PREPAID"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Airtime, Data & Bills (VTU)_purchaseUtilityBill_example
const url = 'https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"idempotencyKey":"{{$guid}}","meterVerificationId":"{{meter_verification_id}}","settlementId":1,"amount":5000,"vendType":"PREPAID"}'
};

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

```go Airtime, Data & Bills (VTU)_purchaseUtilityBill_example
package main

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

func main() {

	url := "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility"

	payload := strings.NewReader("{\n  \"idempotencyKey\": \"{{$guid}}\",\n  \"meterVerificationId\": \"{{meter_verification_id}}\",\n  \"settlementId\": 1,\n  \"amount\": 5000,\n  \"vendType\": \"PREPAID\"\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 Airtime, Data & Bills (VTU)_purchaseUtilityBill_example
require 'uri'
require 'net/http'

url = URI("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility")

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  \"idempotencyKey\": \"{{$guid}}\",\n  \"meterVerificationId\": \"{{meter_verification_id}}\",\n  \"settlementId\": 1,\n  \"amount\": 5000,\n  \"vendType\": \"PREPAID\"\n}"

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

```java Airtime, Data & Bills (VTU)_purchaseUtilityBill_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"idempotencyKey\": \"{{$guid}}\",\n  \"meterVerificationId\": \"{{meter_verification_id}}\",\n  \"settlementId\": 1,\n  \"amount\": 5000,\n  \"vendType\": \"PREPAID\"\n}")
  .asString();
```

```php Airtime, Data & Bills (VTU)_purchaseUtilityBill_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility', [
  'body' => '{
  "idempotencyKey": "{{$guid}}",
  "meterVerificationId": "{{meter_verification_id}}",
  "settlementId": 1,
  "amount": 5000,
  "vendType": "PREPAID"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Airtime, Data & Bills (VTU)_purchaseUtilityBill_example
using RestSharp;

var client = new RestClient("https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"idempotencyKey\": \"{{$guid}}\",\n  \"meterVerificationId\": \"{{meter_verification_id}}\",\n  \"settlementId\": 1,\n  \"amount\": 5000,\n  \"vendType\": \"PREPAID\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Airtime, Data & Bills (VTU)_purchaseUtilityBill_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "idempotencyKey": "{{$guid}}",
  "meterVerificationId": "{{meter_verification_id}}",
  "settlementId": 1,
  "amount": 5000,
  "vendType": "PREPAID"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://shimi-waas-api-9493532b9281.herokuapp.com/api/v1/vtu/purchase-utility")! 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()
```