Skip to main content

Overview

Retrieve a paginated list of your wallet transactions, including both debits (payments) and credits (deposits).
Required permission: payment:read

Endpoint

GET /api/payments/list-transactions

Request

Headers

X-API-Key
string
required
Your Chidori API key

Query parameters

page
number
default:"1"
Page number for pagination
limit
number
default:"20"
Number of items per page (max 100)

Response

Success response

status
boolean
Always true for successful requests
data
object

Examples

curl "https://api.chidori.africa/api/payments/list-transactions?page=1&limit=20" \
  -H "X-API-Key: sk_live_xxx.yyy"
{
  "status": true,
  "data": {
    "page": 1,
    "limit": 20,
    "total": 45,
    "items": [
      {
        "id": "txn-123-456-789",
        "type": "DEBIT",
        "amount": 2500,
        "reference": "order_12345_payment",
        "description": "Delivery payment - CHI-ABC123",
        "balanceBefore": 50000,
        "balanceAfter": 47500,
        "createdAt": "2025-01-15T10:30:00.000Z"
      },
      {
        "id": "txn-456-789-012",
        "type": "CREDIT",
        "amount": 100000,
        "reference": "deposit_paystack_xyz",
        "description": "Wallet funding",
        "balanceBefore": 0,
        "balanceAfter": 100000,
        "createdAt": "2025-01-15T09:00:00.000Z"
      }
    ]
  }
}

Transaction types

TypeDescription
DEBITMoney deducted from wallet (delivery payments)
CREDITMoney added to wallet (deposits, refunds)

Use cases

async function getMonthlyStatement(year, month) {
  const transactions = [];
  let page = 1;
  let hasMore = true;
  
  while (hasMore) {
    const response = await fetch(
      `https://api.chidori.africa/api/payments/list-transactions?page=${page}&limit=100`,
      { headers: { 'X-API-Key': apiKey } }
    );
    const { data } = await response.json();
    
    // Filter by month
    const monthlyTxns = data.items.filter(txn => {
      const date = new Date(txn.createdAt);
      return date.getFullYear() === year && date.getMonth() === month - 1;
    });
    
    transactions.push(...monthlyTxns);
    hasMore = data.items.length === 100;
    page++;
  }
  
  return transactions;
}
async function calculateTotalSpending() {
  let totalSpent = 0;
  let page = 1;
  let hasMore = true;
  
  while (hasMore) {
    const response = await fetch(
      `https://api.chidori.africa/api/payments/list-transactions?page=${page}&limit=100`,
      { headers: { 'X-API-Key': apiKey } }
    );
    const { data } = await response.json();
    
    totalSpent += data.items
      .filter(txn => txn.type === 'DEBIT')
      .reduce((sum, txn) => sum + txn.amount, 0);
    
    hasMore = data.items.length === 100;
    page++;
  }
  
  return totalSpent;
}

Next steps