Skip to content

Transactions API

Retrieve payment transaction records for your business.

The Transactions API gives you read access to all payment transactions processed through Cashfin — mobile money payments, invoice payments, subscription charges, and more. Use it to build reconciliation tools, financial dashboards, or sync transaction data to accounting systems.

Read-Only

The Transactions API is read-only. Transactions are created automatically when payments are processed.

Use Cases

  • Reconciliation: Match transactions against your bank records or ERP
  • Financial Reporting: Pull daily, weekly, or monthly transaction summaries
  • Accounting Sync: Push transaction data to external accounting software

Endpoints

MethodEndpointDescription
GET/business/transaction/listList all transactions
GET/business/transaction/details/:idGet transaction details

List Transactions

Retrieve a paginated list of transactions.

http
GET /business/transaction/list

Query Parameters

ParameterTypeDefaultDescription
pageinteger1Page number
limitinteger10Results per page (max: 100)
searchstring-Search by title, transaction code, or reference
statusstring-Filter by status: pending, completed, failed, cancelled
typestring-Filter by type: credit, debit
channelstring-Filter by channel: mpesa, invoice, subscription, order, manual

Example Request

bash
curl -X GET "https://api.cashfin.africa/business/transaction/list?page=1&limit=10&status=completed" \
  -H "Authorization: cs_your_client_secret"
javascript
const response = await fetch(
  "https://api.cashfin.africa/business/transaction/list?page=1&limit=10&status=completed",
  {
    headers: { Authorization: "cs_your_client_secret" },
  }
);
const data = await response.json();
php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL            => "https://api.cashfin.africa/business/transaction/list?page=1&limit=10",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER     => ["Authorization: cs_your_client_secret"],
]);

$result = json_decode(curl_exec($curl), true);
python
import requests

response = requests.get(
    'https://api.cashfin.africa/business/transaction/list',
    headers={'Authorization': 'cs_your_client_secret'},
    params={
        'page': 1,
        'limit': 10,
        'status': 'completed',
        'channel': 'mpesa'
    }
)

Success Response

json
{
  "success": true,
  "data": [
    {
      "_id": "507f1f77bcf86cd799439050",
      "title": "M-Pesa Payment - INV-2024-001",
      "code": "TXN-2024-001",
      "amount": 12500.0,
      "type": "credit",
      "status": "completed",
      "channel": "mpesa",
      "reference": "QHG2K4L8MN",
      "createdat": "2024-01-15T14:22:00.000Z"
    }
  ],
  "pagination": {
    "total": 148,
    "page": 1,
    "limit": 10,
    "pages": 15
  }
}

Get Transaction Details

Retrieve full details of a specific transaction.

http
GET /business/transaction/details/:id

Path Parameters

ParameterTypeRequiredDescription
idstringYesTransaction ID (MongoDB ObjectID)

Example Request

bash
curl -X GET "https://api.cashfin.africa/business/transaction/details/507f1f77bcf86cd799439050" \
  -H "Authorization: cs_your_client_secret"
javascript
const txId = "507f1f77bcf86cd799439050";

const response = await fetch(
  `https://api.cashfin.africa/business/transaction/details/${txId}`,
  {
    headers: { Authorization: "cs_your_client_secret" },
  }
);
const data = await response.json();
python
import requests

tx_id = '507f1f77bcf86cd799439050'

response = requests.get(
    f'https://api.cashfin.africa/business/transaction/details/{tx_id}',
    headers={'Authorization': 'cs_your_client_secret'}
)

Success Response

json
{
  "success": true,
  "data": {
    "_id": "507f1f77bcf86cd799439050",
    "title": "M-Pesa Payment - INV-2024-001",
    "code": "TXN-2024-001",
    "amount": 12500.0,
    "type": "credit",
    "status": "completed",
    "channel": "mpesa",
    "reference": "QHG2K4L8MN",
    "note": "Payment for office supplies invoice",
    "createdat": "2024-01-15T14:22:00.000Z",
    "updatedat": "2024-01-15T14:22:45.000Z"
  }
}

Transaction Statuses

StatusDescription
pendingPayment initiated, awaiting confirmation
completedPayment successfully processed
failedPayment failed or declined
cancelledPayment cancelled

Transaction Types

TypeDescription
creditMoney received (payment in)
debitMoney paid out

Transaction Channels

ChannelDescription
mpesaM-Pesa mobile money payment
invoicePayment received against an invoice
subscriptionRecurring subscription charge
orderPayment for a shop order
manualManually recorded transaction

Error Responses

Transaction Not Found

json
{
  "success": false,
  "error": "Transaction not found"
}

Invalid Transaction ID

json
{
  "success": false,
  "error": "Invalid transaction ID format"
}

Cashfin Business API Documentation