lomi.
Platform

Customers

Manage customer profiles and track their payment history.

The Customers API allows you to create, retrieve, update, and manage customer profiles associated with your merchant account.

Create a customer

Create a new customer profile to track payments and store information.

Request Body

FieldTypeRequiredDescription
namestringYesCustomer full name
emailstringNoCustomer email address
phone_numberstringNoPhone number (e.g., +221771234567)
whatsapp_numberstringNoWhatsApp number
countrystringNoCountry name
citystringNoCity name
addressstringNoStreet address
postal_codestringNoPostal/ZIP code
is_businessbooleanNoWhether customer is a business (default: false)
metadataobjectNoCustom key-value pairs
import { LomiSDK } from '@lomi./sdk';

const lomi = new LomiSDK({
  apiKey: process.env.LOMI_API_KEY!,
  environment: 'live',
});

const customer = await lomi.customers.create({
  name: 'Amadou Ba',
  email: 'amadou.ba@example.com',
  phone_number: '+221771234567',
  country: 'Senegal',
  city: 'Dakar',
  is_business: false,
  metadata: {
    internal_id: 'USER_123',
  },
});

console.log(`Customer created: ${customer.id}`);
from lomi import LomiClient
import os

client = LomiClient(
    api_key=os.environ["LOMI_API_KEY"],
    environment="test"
)

customer = client.customers.create({
    "name": "Amadou Ba",
    "email": "amadou.ba@example.com",
    "phone_number": "+221771234567",
    "country": "Senegal",
    "city": "Dakar",
    "is_business": False,
    "metadata": {"internal_id": "USER_123"}
})

print(f"Customer created: {customer['id']}")
curl -X POST "https://api.lomi.africa/customers" \
  -H "X-API-KEY: $LOMI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Amadou Ba",
    "email": "amadou.ba@example.com",
    "phone_number": "+221771234567",
    "country": "Senegal",
    "city": "Dakar",
    "is_business": false,
    "metadata": {"internal_id": "USER_123"}
  }'

List customers

Retrieve all customers with optional filtering and pagination.

Query Parameters

ParameterTypeDescription
searchstringSearch by name or email
typestringFilter by type: business, individual, all
statusstringFilter by activity: active, inactive, all
pagenumberPage number (default: 1)
pageSizenumberItems per page (default: 50)
const customers = await lomi.customers.list({
  search: 'amadou',
  type: 'individual',
  status: 'active',
  page: 1,
  pageSize: 20,
});
customers = client.customers.list(
    search="amadou",
    type="individual",
    status="active",
    page=1,
    pageSize=20
)
curl -X GET "https://api.lomi.africa/customers?search=amadou&type=individual&page=1&pageSize=20" \
  -H "X-API-KEY: $LOMI_API_KEY"

Response

{
  "customers": [...],
  "pagination": {
    "page": 1,
    "pageSize": 20,
    "totalCount": 150,
    "totalPages": 8
  }
}

Get a customer

Retrieve details of a specific customer.

const customer = await lomi.customers.get('cus_abc123...');
customer = client.customers.get('cus_abc123...')
curl -X GET "https://api.lomi.africa/customers/cus_abc123..." \
  -H "X-API-KEY: $LOMI_API_KEY"

Update a customer

Update an existing customer's details. All fields are optional.

const updated = await lomi.customers.update('cus_abc123...', {
  email: 'new.email@example.com',
  metadata: { vip: true },
});
updated = client.customers.update('cus_abc123...', {
    "email": "new.email@example.com",
    "metadata": {"vip": True}
})
curl -X PATCH "https://api.lomi.africa/customers/cus_abc123..." \
  -H "X-API-KEY: $LOMI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email": "new.email@example.com"}'

Delete a customer

Soft-delete a customer. The customer is marked as deleted but not removed from the database.

await lomi.customers.delete('cus_abc123...');
client.customers.delete('cus_abc123...')
curl -X DELETE "https://api.lomi.africa/customers/cus_abc123..." \
  -H "X-API-KEY: $LOMI_API_KEY"

Get customer transactions

Retrieve all transactions for a specific customer.

const transactions = await lomi.customers.getTransactions('cus_abc123...');

transactions.forEach(tx => {
  console.log(`${tx.description}: ${tx.gross_amount} ${tx.currency_code}`);
});
transactions = client.customers.get_transactions('cus_abc123...')

for tx in transactions:
    print(f"{tx['description']}: {tx['gross_amount']} {tx['currency_code']}")
curl -X GET "https://api.lomi.africa/customers/cus_abc123.../transactions" \
  -H "X-API-KEY: $LOMI_API_KEY"

Response

[
  {
    "transaction_id": "tx_def456...",
    "description": "Payment for Product A",
    "gross_amount": 10000,
    "currency_code": "XOF",
    "status": "completed",
    "created_at": "2024-01-15T10:30:00Z"
  }
]

Customer Object

FieldTypeDescription
idstringUnique customer identifier
organization_idstringOrganization that owns this customer
namestringCustomer full name
emailstringEmail address
phone_numberstringPhone number
whatsapp_numberstringWhatsApp number
countrystringCountry
citystringCity
addressstringStreet address
postal_codestringPostal code
is_businessbooleanBusiness customer flag
metadataobjectCustom metadata
created_atstringCreation timestamp
updated_atstringLast update timestamp

Error Responses

StatusDescription
400Invalid input data
401Invalid or missing API key
404Customer not found or access denied

On this page