Appearance
Balance
Retrieve the current wallet balances for your merchant account.
Get Balance
http
GET /api/v1/balanceAuthentication
Requires API key authentication.
Response
json
{
"data": {
"wallets": [
{
"currency": "USD",
"balance": "5000.00",
"balance_units": 500000,
"decimals": 2
}
]
}
}Response Fields
| Field | Type | Description |
|---|---|---|
wallets | array | Array of wallet balances |
wallets[].currency | string | Currency code (e.g., "USD") |
wallets[].balance | string | Formatted balance |
wallets[].balance_units | integer | Balance in smallest currency unit (e.g., cents for USD) |
wallets[].decimals | integer | Number of decimal places for the currency |
Example Requests
cURL
bash
#!/bin/bash
API_KEY="your_api_key"
curl -X GET "https://dev-crypto-portal.kesspay.io/api/v1/balance" \
-H "X-Api-Key: ${API_KEY}"PHP
php
<?php
use GuzzleHttp\Client;
$apiKey = 'your_api_key';
$client = new Client(['base_uri' => 'https://dev-crypto-portal.kesspay.io']);
$response = $client->request('GET', '/api/v1/balance', [
'headers' => [
'X-Api-Key' => $apiKey,
]
]);
$data = json_decode($response->getBody(), true);
print_r($data);JavaScript
javascript
const axios = require('axios');
async function getBalance() {
const apiKey = 'your_api_key';
try {
const response = await axios.get('https://dev-crypto-portal.kesspay.io/api/v1/balance', {
headers: {
'X-Api-Key': apiKey
}
});
console.log('Wallets:', response.data.data.wallets);
return response.data;
} catch (error) {
console.error('Error fetching balance:', error.response.data);
}
}
getBalance();Python
python
import requests
def get_balance():
api_key = 'your_api_key'
response = requests.get(
'https://dev-crypto-portal.kesspay.io/api/v1/balance',
headers={
'X-Api-Key': api_key
}
)
data = response.json()
for wallet in data['data']['wallets']:
print(f"Balance: {wallet['balance']} {wallet['currency']}")
return data
get_balance()Error Responses
401 Unauthorized
json
{
"success": false,
"message": "Unauthenticated. Please provide valid credentials.",
"errors": null
}403 Forbidden
json
{
"success": false,
"message": "Merchant account is suspended",
"errors": null
}Use Cases
- Check balance before initiating a transfer
- Display current balance in your application dashboard
- Monitor balance changes via polling or webhooks
- Reconcile transactions against balance
Notes
- Balance is updated in real-time
- All amounts are stored in the smallest currency unit (e.g., cents for USD) to avoid floating-point precision issues
- Balance reflects available funds after pending transfers
- Multiple wallets may be returned if your account supports multiple currencies
- Use webhooks to receive real-time balance updates