Skip to content

CRM API Overview

The CRM API allows you to manage customer relationships programmatically.

Build lasting customer relationships with comprehensive profile management. The CRM module integrates seamlessly with orders, invoices, and subscriptions to provide a complete view of each customer's journey with your business.

What You Can Build

  • Customer Portals: Create and manage customer accounts
  • Marketing Platforms: Segment customers for targeted campaigns
  • Support Systems: Access customer history for better support
  • Analytics Dashboards: Track customer lifetime value and engagement

Customers

The Customers API allows you to create and manage customer records.

Available Endpoints

MethodEndpointDescription
POST/business/customer/createCreate a new customer
GET/business/customer/listGet list of customers

Customer Data

Customers in Cashfin can include:

  • Contact information (name, email, phone)
  • Address details
  • Payment methods
  • Associated orders and transactions

Quick Example

Create a Customer

bash
curl -X POST "https://api.cashfin.africa/business/customer/create" \
  -H "Authorization: cs_your_client_secret" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe",
    "email": "[email protected]",
    "phone": "+254712345678",
    "country": "Kenya",
    "currency": "KES"
  }'

Response

json
{
  "success": true,
  "message": "Customer created successfully",
  "data": {
    "_id": "507f1f77bcf86cd799439011",
    "name": "John Doe",
    "email": "[email protected]",
    "phone": "+254712345678"
  }
}

Customer Types

TypeDescription
individualPersonal customer
businessBusiness/corporate customer

Use Cases

E-commerce Customer Sync

Sync customers from your e-commerce platform:

javascript
async function syncCustomer(externalCustomer) {
  const response = await fetch(
    "https://api.cashfin.africa/business/customer/create",
    {
      method: "POST",
      headers: {
        Authorization: API_KEY,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        name: externalCustomer.fullName,
        email: externalCustomer.email,
        phone: externalCustomer.phone,
        country: externalCustomer.country,
        currency: "KES",
        type: externalCustomer.isCompany ? "business" : "individual",
      }),
    }
  );

  return response.json();
}

Customer-First Order Creation

Create customer before order:

javascript
async function createOrderWithCustomer(orderData, customerData) {
  // 1. Create or find customer
  const customerResponse = await fetch(
    "https://api.cashfin.africa/business/customer/create",
    {
      method: "POST",
      headers: {
        Authorization: API_KEY,
        "Content-Type": "application/json",
      },
      body: JSON.stringify(customerData),
    }
  );

  const { data: customer } = await customerResponse.json();

  // 2. Create order with customer ID
  const orderResponse = await fetch(
    "https://api.cashfin.africa/business/order/checkout",
    {
      method: "POST",
      headers: {
        Authorization: API_KEY,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        ...orderData,
        customeremail: customer.email,
      }),
    }
  );

  return orderResponse.json();
}

Next Steps

Cashfin Business API Documentation