Skip to content

Getting Started

Welcome to the Cashfin Business API! This guide will help you get up and running with our external APIs in minutes.

Overview

The Cashfin Business API enables you to:

  • Manage Products & Categories - Create, update, and list your product catalog
  • Process Payments - Accept M-Pesa mobile payments
  • Handle Orders - Create checkout orders with automatic payment links
  • Manage Customers - Create and maintain customer records
  • Subscriptions - Set up recurring billing with flexible cycles

Prerequisites

Before you begin, you'll need:

  1. A Cashfin Business Account - Sign up here if you don't have one
  2. API Credentials - Generate your Client Secret from the Business Dashboard

Quick Start

Step 1: Get Your Client Secret

  1. Log in to your Cashfin Business Dashboard
  2. Navigate to SettingsAPI
  3. Click Create API Credentials
  4. Copy your Client Secret securely

Important

Keep your Client Secret secure! Never expose it in client-side code or public repositories.

Step 2: Make Your First Request

Test your Client Secret by fetching your product list:

bash
curl -X GET "https://api.cashfin.africa/business/product/list" \
  -H "Authorization: cs_your_client_secret" \
  -H "Content-Type: application/json"
javascript
const response = await fetch(
  "https://api.cashfin.africa/business/product/list",
  {
    method: "GET",
    headers: {
      Authorization: process.env.CASHFIN_CLIENT_SECRET,
      "Content-Type": "application/json",
    },
  }
);

const data = await response.json();
console.log(data);
php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.cashfin.africa/business/product/list",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: " . getenv('CASHFIN_CLIENT_SECRET'),
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
curl_close($curl);

$data = json_decode($response, true);
print_r($data);
python
import os
import requests

headers = {
    'Authorization': os.environ.get('CASHFIN_CLIENT_SECRET'),
    'Content-Type': 'application/json'
}

response = requests.get(
    'https://api.cashfin.africa/business/product/list',
    headers=headers
)

data = response.json()
print(data)

Step 3: Verify the Response

A successful response will look like this:

json
{
  "success": true,
  "data": [
    {
      "_id": "507f1f77bcf86cd799439011",
      "title": "Premium Widget",
      "price": 1999.99,
      "stock": 100,
      "sku": "PRD-001",
      "status": "published"
    }
  ],
  "meta": {
    "total": 1,
    "page": 1,
    "limit": 10
  }
}

What's Next?

Now that you've made your first API call, explore more:

Need Help?

Cashfin Business API Documentation