Access your account balance by making an HTTP GET request to the following endpoint:
https://api.statum.co.ke/api/v2/account-balance
To check your account balance, send an HTTP GET request to the above endpoint. Along with the standard API request headers, the request body should include the following field:
| Parameter | Type | Description | Example |
|---|---|---|---|
| command_id | String | Set this to "balance" | balance |
Here is an example of how to make an API call to check your account balance:
<?php
// Credentials from your developer account
$consumerKey = "568473daf6614cb196caeb5f8805985f";
$consumerSecret = "5a07f41de16e40e4b08b4001142a5a10";
$auth = base64_encode($consumerKey . ":" . $consumerSecret);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.statum.co.ke/api/v2/account-balance',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
"Authorization: Basic $auth",
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
The response will be a JSON object with the following fields:
| Parameter | Type | Description | Example |
|---|---|---|---|
| status_code | Number | The status code of the transaction. | 200 |
| description | String | The description of the transaction status. | Operation successful |
| request_id | String | The unique reference number assigned by the Statum API. | 87e6ede99a0d4201b0d7ee347e5b2788 |
| available_balance | Decimal | Your current account balance. | 10001.45 |
Below is an example of a successful API response payload:
{
"status_code": 200,
"description": "Operation successful.",
"request_id": "87e6ede99a0d4201b0d7ee347e5b2788",
"available_balance": 10001.45
}