Platform
Accounts
Manage merchant accounts and check balances.
The Accounts API provides access to your merchant account information and balance details.
List accounts
Retrieve all accounts associated with your organization.
import { LomiSDK } from '@lomi./sdk';
const lomi = new LomiSDK({
apiKey: process.env.LOMI_API_KEY!,
environment: 'live',
});
const accounts = await lomi.accounts.list();
accounts.forEach(account => {
console.log(`${account.name}: ${account.id}`);
});from lomi import LomiClient
import os
client = LomiClient(
api_key=os.environ["LOMI_API_KEY"],
environment="test"
)
accounts = client.accounts.list()
for account in accounts:
print(f"{account['name']}: {account['id']}")curl -X GET "https://api.lomi.africa/accounts" \
-H "X-API-KEY: $LOMI_API_KEY"Get account by ID
Retrieve details of a specific account.
const account = await lomi.accounts.get('acc_abc123...');account = client.accounts.get('acc_abc123...')curl -X GET "https://api.lomi.africa/accounts/acc_abc123..." \
-H "X-API-KEY: $LOMI_API_KEY"Get account balance
Fetch current account balance for all currencies or a specific currency.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
currency | string | Filter by currency: XOF, USD, EUR |
// All currencies
const balances = await lomi.accounts.getBalance();
// Specific currency
const xofBalance = await lomi.accounts.getBalance({ currency: 'XOF' });
console.log(`Available: ${xofBalance.available}`);
console.log(`Pending: ${xofBalance.pending}`);# All currencies
balances = client.accounts.get_balance()
# Specific currency
xof_balance = client.accounts.get_balance(currency="XOF")
print(f"Available: {xof_balance['available']}")# All currencies
curl -X GET "https://api.lomi.africa/accounts/balance" \
-H "X-API-KEY: $LOMI_API_KEY"
# Specific currency
curl -X GET "https://api.lomi.africa/accounts/balance?currency=XOF" \
-H "X-API-KEY: $LOMI_API_KEY"Get detailed balance breakdown
Fetch detailed balance breakdown with optional currency conversion.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
target_currency | string | Convert all balances to this currency |
// Get breakdown
const breakdown = await lomi.accounts.getBalanceBreakdown();
// With currency conversion
const convertedBreakdown = await lomi.accounts.getBalanceBreakdown({
target_currency: 'USD',
});
console.log(`Total in USD: ${convertedBreakdown.total}`);breakdown = client.accounts.get_balance_breakdown(target_currency="USD")
print(f"Total in USD: {breakdown['total']}")curl -X GET "https://api.lomi.africa/accounts/balance/breakdown?target_currency=USD" \
-H "X-API-KEY: $LOMI_API_KEY"Check available balance
Check if you have sufficient balance in a specific currency.
const check = await lomi.accounts.checkBalance('XOF');
if (check.has_sufficient_balance) {
console.log(`Available: ${check.available_balance} XOF`);
} else {
console.log('Insufficient balance');
}check = client.accounts.check_balance("XOF")
print(f"Has balance: {check['has_sufficient_balance']}")
print(f"Available: {check['available_balance']}")curl -X GET "https://api.lomi.africa/accounts/balance/check/XOF" \
-H "X-API-KEY: $LOMI_API_KEY"Response
{
"has_sufficient_balance": true,
"available_balance": 500000
}Account Object
| Field | Type | Description |
|---|---|---|
id | string | Unique account identifier |
organization_id | string | Associated organization |
name | string | Account name |
currency_code | string | Primary currency |
created_at | string | Creation timestamp |
Balance Object
| Field | Type | Description |
|---|---|---|
available | number | Available for withdrawal |
pending | number | Pending settlement |
total | number | Total balance |
currency_code | string | Currency code |
Error Responses
| Status | Description |
|---|---|
401 | Invalid or missing API key |
404 | Account not found |