Overview
Track all your transactions across Naira wallet, crypto, offramp, and bill payments in one unified interface. This guide covers transaction management, monitoring, and reporting. What you’ll learn:- Get all transactions
- View transaction details
- Track transaction status
- Search and filter
- Export transaction data
Transaction Types
Monei supports multiple transaction types:Naira
Deposits, payouts, transfers
Crypto
EVM and Solana transactions
Offramp
Crypto to fiat conversions
Bill Payments
Airtime, data, utilities
Swaps
Token swaps on DEXs
P2P
Peer-to-peer transfers
Get All Transactions
Retrieve all your transactions across all types.import MoneiSDK from 'monei-sdk';
const monei = new MoneiSDK({
apiKey: process.env.MONEI_API_KEY,
});
// Get all transactions
const transactions = await monei.transactions.getAll({
page: 1,
limit: 20,
sortBy: 'createdAt',
sortOrder: 'desc'
});
console.log(`Total Transactions: ${transactions.pagination.total}\n`);
transactions.transactions.forEach(tx => {
console.log(`${tx.type} - ₦${tx.amount} ${tx.currency}`);
console.log(` Status: ${tx.status}`);
console.log(` Reference: ${tx.reference}`);
console.log(` Date: ${new Date(tx.createdAt).toLocaleString()}`);
console.log(` Narration: ${tx.narration || 'N/A'}`);
console.log('');
});
from monei import MoneiClient
monei = MoneiClient(
api_key=os.getenv('MONEI_API_KEY')
)
# Get all transactions
transactions = monei.transactions.get_all(
page=1,
limit=20,
sort_by='createdAt',
sort_order='desc'
)
print(f'Total: {transactions.pagination.total}\n')
for tx in transactions.transactions:
print(f'{tx.type} - ₦{tx.amount} {tx.currency}')
print(f' Status: {tx.status}')
print(f' Reference: {tx.reference}')
print(f' Date: {tx.created_at}')
print()
curl "https://api.monei.cc/api/v1/transactions/user?page=1&limit=20&sortBy=createdAt&sortOrder=desc" \
-H "x-api-key: YOUR_API_KEY"
| Parameter | Type | Description | Default |
|---|---|---|---|
page | number | Page number | 1 |
limit | number | Items per page (max: 100) | 10 |
status | string | Filter by status | All |
type | string | Filter by type | All |
currency | string | Filter by currency | All |
minAmount | number | Minimum amount | None |
maxAmount | number | Maximum amount | None |
startDate | string | Start date (YYYY-MM-DD) | None |
endDate | string | End date (YYYY-MM-DD) | None |
sortBy | string | Sort field | createdAt |
sortOrder | string | asc or desc | desc |
{
"statusCode": 200,
"message": "Transactions retrieved successfully",
"data": {
"transactions": [
{
"id": "tx_abc123",
"reference": "TXN-ABC123XYZ",
"type": "DEBIT",
"status": "SUCCESS",
"amount": 5000,
"currency": "NGN",
"narration": "MTN Airtime Purchase",
"metadata": {
"billerId": "mtn-ng",
"customerName": "JOHN DOE"
},
"createdAt": "2024-02-15T10:30:00Z",
"updatedAt": "2024-02-15T10:30:05Z"
}
],
"pagination": {
"page": 1,
"limit": 20,
"total": 150,
"pages": 8
}
}
}
Transaction Types
| Type | Description | Example |
|---|---|---|
DEBIT | Money leaving your wallet | Bill payment, payout, transfer out |
CREDIT | Money entering your wallet | Deposit, refund, transfer in |
PEER-TRANSFER | P2P transfer | Send/receive from other users |
SWAP | Token exchange | DEX swap on EVM/Solana |
OFFRAMP | Crypto to fiat | USDT to NGN conversion |
Transaction Status
Understanding transaction states:| Status | Description | Final State |
|---|---|---|
PENDING | Transaction initiated | No |
PROCESSING | Being processed | No |
SUCCESS | Completed successfully | Yes |
COMPLETED | Fully completed | Yes |
FAILED | Transaction failed | Yes |
REVERSED | Reversed/refunded | Yes |
CANCELLED | Cancelled by user | Yes |
Get Transaction by ID
Retrieve specific transaction details.// Get transaction by ID
const transaction = await monei.transactions.getById('tx_abc123');
console.log('Transaction Details:');
console.log('===================');
console.log('ID:', transaction.id);
console.log('Reference:', transaction.reference);
console.log('Type:', transaction.type);
console.log('Status:', transaction.status);
console.log('Amount:', transaction.amount, transaction.currency);
console.log('Narration:', transaction.narration);
console.log('Created:', new Date(transaction.createdAt).toLocaleString());
console.log('Updated:', new Date(transaction.updatedAt).toLocaleString());
// Check metadata for additional info
if (transaction.metadata) {
console.log('\nMetadata:');
console.log(JSON.stringify(transaction.metadata, null, 2));
}
// For blockchain transactions
if (transaction.metadata?.signature || transaction.metadata?.txHash) {
console.log('\nBlockchain Details:');
console.log('Hash:', transaction.metadata.signature || transaction.metadata.txHash);
console.log('Network:', transaction.metadata.network || transaction.metadata.chainId);
}
# Get by ID
transaction = monei.transactions.get_by_id('tx_abc123')
print('Transaction Details:')
print('=' * 20)
print(f'ID: {transaction.id}')
print(f'Reference: {transaction.reference}')
print(f'Type: {transaction.type}')
print(f'Status: {transaction.status}')
print(f'Amount: {transaction.amount} {transaction.currency}')
print(f'Narration: {transaction.narration}')
print(f'Created: {transaction.created_at}')
if transaction.metadata:
print('\nMetadata:')
print(transaction.metadata)
curl https://api.monei.cc/api/v1/transactions/tx_abc123 \
-H "x-api-key: YOUR_API_KEY"
Get Transaction by Reference
Retrieve transaction using your custom reference.// Get by reference
const transaction = await monei.transactions.getByReference('TXN-ABC123XYZ');
console.log('Transaction found!');
console.log('ID:', transaction.id);
console.log('Reference:', transaction.reference);
console.log('Status:', transaction.status);
console.log('Amount:', transaction.amount, transaction.currency);
# Get by reference
transaction = monei.transactions.get_by_reference('TXN-ABC123XYZ')
print('Transaction found!')
print(f'ID: {transaction.id}')
print(f'Reference: {transaction.reference}')
print(f'Status: {transaction.status}')
curl https://api.monei.cc/api/v1/transactions/reference/TXN-ABC123XYZ \
-H "x-api-key: YOUR_API_KEY"
Filter Transactions
Filter transactions by various criteria.// Get successful transactions only
const successful = await monei.transactions.getAll({
status: 'SUCCESS',
limit: 20
});
console.log('Successful Transactions:', successful.pagination.total);
// Get debit transactions (money out)
const debits = await monei.transactions.getAll({
type: 'DEBIT',
limit: 20
});
console.log('Debit Transactions:', debits.pagination.total);
// Get credit transactions (money in)
const credits = await monei.transactions.getAll({
type: 'CREDIT',
limit: 20
});
console.log('Credit Transactions:', credits.pagination.total);
// Get transactions by currency
const usdTransactions = await monei.transactions.getAll({
currency: 'USD',
limit: 20
});
console.log('USD Transactions:', usdTransactions.pagination.total);
// Get transactions by amount range
const largeTransactions = await monei.transactions.getAll({
minAmount: 10000,
maxAmount: 100000,
limit: 20
});
console.log('Large Transactions (₦10K-₦100K):', largeTransactions.pagination.total);
// Get transactions by date range
const thisMonth = await monei.transactions.getAll({
startDate: '2024-02-01',
endDate: '2024-02-29',
limit: 100
});
console.log('This Month:', thisMonth.pagination.total);
# Successful only
successful = monei.transactions.get_all(
status='SUCCESS',
limit=20
)
print(f'Successful: {successful.pagination.total}')
# Debits only
debits = monei.transactions.get_all(
type='DEBIT',
limit=20
)
print(f'Debits: {debits.pagination.total}')
# By currency
usd_txns = monei.transactions.get_all(
currency='USD',
limit=20
)
print(f'USD Transactions: {usd_txns.pagination.total}')
# By amount range
large_txns = monei.transactions.get_all(
min_amount=10000,
max_amount=100000,
limit=20
)
print(f'Large Transactions: {large_txns.pagination.total}')
# By date range
this_month = monei.transactions.get_all(
start_date='2024-02-01',
end_date='2024-02-29',
limit=100
)
print(f'This Month: {this_month.pagination.total}')
Transaction Analytics
Analyze your transaction patterns.async function analyzeTransactions(startDate, endDate) {
// Get all transactions
const txns = await monei.transactions.getAll({
startDate: startDate,
endDate: endDate,
limit: 1000
});
const analytics = {
total: txns.pagination.total,
totalIn: 0,
totalOut: 0,
byType: {},
byCurrency: {},
byStatus: {},
largestTransaction: null
};
// Process each transaction
txns.transactions.forEach(tx => {
// Calculate in/out
if (tx.type === 'CREDIT') {
analytics.totalIn += tx.amount;
} else if (tx.type === 'DEBIT') {
analytics.totalOut += tx.amount;
}
// By type
analytics.byType[tx.type] = (analytics.byType[tx.type] || 0) + 1;
// By currency
analytics.byCurrency[tx.currency] =
(analytics.byCurrency[tx.currency] || 0) + tx.amount;
// By status
analytics.byStatus[tx.status] = (analytics.byStatus[tx.status] || 0) + 1;
// Largest transaction
if (!analytics.largestTransaction || tx.amount > analytics.largestTransaction.amount) {
analytics.largestTransaction = tx;
}
});
// Calculate net
analytics.net = analytics.totalIn - analytics.totalOut;
// Display
console.log('Transaction Analytics');
console.log('====================');
console.log('Total Transactions:', analytics.total);
console.log('Total In: ₦' + analytics.totalIn.toLocaleString());
console.log('Total Out: ₦' + analytics.totalOut.toLocaleString());
console.log('Net: ₦' + analytics.net.toLocaleString());
console.log('\nBy Type:');
Object.entries(analytics.byType).forEach(([type, count]) => {
console.log(` ${type}: ${count}`);
});
console.log('\nBy Currency:');
Object.entries(analytics.byCurrency).forEach(([currency, amount]) => {
console.log(` ${currency}: ${amount.toLocaleString()}`);
});
console.log('\nBy Status:');
Object.entries(analytics.byStatus).forEach(([status, count]) => {
console.log(` ${status}: ${count}`);
});
console.log('\nLargest Transaction:');
console.log(` ${analytics.largestTransaction.type}: ${analytics.largestTransaction.amount} ${analytics.largestTransaction.currency}`);
console.log(` ${analytics.largestTransaction.narration}`);
return analytics;
}
// Analyze this month
await analyzeTransactions('2024-02-01', '2024-02-29');
async def analyze_transactions(start_date, end_date):
# Get transactions
txns = monei.transactions.get_all(
start_date=start_date,
end_date=end_date,
limit=1000
)
analytics = {
'total': txns.pagination.total,
'total_in': 0,
'total_out': 0,
'by_type': {},
'by_currency': {},
'by_status': {}
}
# Process
for tx in txns.transactions:
# In/Out
if tx.type == 'CREDIT':
analytics['total_in'] += tx.amount
elif tx.type == 'DEBIT':
analytics['total_out'] += tx.amount
# By type
analytics['by_type'][tx.type] = \
analytics['by_type'].get(tx.type, 0) + 1
# By currency
analytics['by_currency'][tx.currency] = \
analytics['by_currency'].get(tx.currency, 0) + tx.amount
# By status
analytics['by_status'][tx.status] = \
analytics['by_status'].get(tx.status, 0) + 1
# Net
analytics['net'] = analytics['total_in'] - analytics['total_out']
# Display
print('Transaction Analytics')
print('=' * 20)
print(f"Total: {analytics['total']}")
print(f"In: ₦{analytics['total_in']:,}")
print(f"Out: ₦{analytics['total_out']:,}")
print(f"Net: ₦{analytics['net']:,}")
print('\nBy Type:')
for tx_type, count in analytics['by_type'].items():
print(f' {tx_type}: {count}')
return analytics
# Analyze
await analyze_transactions('2024-02-01', '2024-02-29')
Export Transactions
Export transaction data for accounting or reporting.async function exportToCSV(startDate, endDate) {
const txns = await monei.transactions.getAll({
startDate: startDate,
endDate: endDate,
limit: 1000
});
// CSV headers
const headers = [
'Date',
'Reference',
'Type',
'Status',
'Amount',
'Currency',
'Narration'
];
// CSV rows
const rows = txns.transactions.map(tx => [
new Date(tx.createdAt).toISOString(),
tx.reference,
tx.type,
tx.status,
tx.amount,
tx.currency,
tx.narration || ''
]);
// Combine
const csv = [
headers.join(','),
...rows.map(row => row.map(field => `"${field}"`).join(','))
].join('\n');
// Save
const fs = require('fs');
fs.writeFileSync('transactions.csv', csv);
console.log('Exported', txns.transactions.length, 'transactions');
return csv;
}
// Export this month
await exportToCSV('2024-02-01', '2024-02-29');
import csv
async def export_to_csv(start_date, end_date):
txns = monei.transactions.get_user_transactions(
start_date=start_date,
end_date=end_date,
limit=1000
)
# Write CSV
with open('transactions.csv', 'w', newline='') as f:
writer = csv.writer(f)
# Headers
writer.writerow([
'Date', 'Reference', 'Type', 'Status',
'Amount', 'Currency', 'Narration'
])
# Rows
for tx in txns.transactions:
writer.writerow([
tx.created_at,
tx.reference,
tx.type,
tx.status,
tx.amount,
tx.currency,
tx.narration or ''
])
print(f'Exported {len(txns.transactions)} transactions')
# Export
await export_to_csv('2024-02-01', '2024-02-29')
Best Practices
Use Pagination
Don’t fetch all transactions at once - use pagination
Filter Wisely
Use filters to reduce response size and improve performance
Save References
Always save transaction references for tracking
Monitor Status
Check pending transactions regularly
Export Regularly
Export transaction history for accounting
Use Webhooks
Set up webhooks for real-time updates
Next Steps
Filtering
Advanced filtering and search
Naira Wallet
Manage Naira transactions
EVM Blockchain
View crypto transactions
Bill Payments
View bill payment history

