lomi.
Platform

Clients

Gérez les profils clients et consultez leur historique de paiement.

L’API Customers permet de créer, consulter, mettre à jour et gérer les profils clients liés à votre compte marchand.

Créer un client

Crée un profil client pour suivre les paiements et stocker les informations.

Corps de la requête

ChampTypeObligatoireDescription
namestringOuiNom complet
emailstringNonAdresse e-mail
phone_numberstringNonTéléphone (ex. +221771234567)
whatsapp_numberstringNonNuméro WhatsApp
countrystringNonPays
citystringNonVille
addressstringNonAdresse
postal_codestringNonCode postal
is_businessbooleanNonClient professionnel (défaut : false)
metadataobjectNonMétadonnées clé-valeur
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"}
  }'

Lister les clients

Récupère les clients avec filtres et pagination optionnels.

Paramètres de requête

ParamètreTypeDescription
searchstringRecherche par nom ou e-mail
typestringType : business, individual, all
statusstringActivité : active, inactive, all
pagenumberPage (défaut : 1)
pageSizenumberTaille de page (défaut : 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"

Réponse

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

Obtenir un client

Récupère le détail d’un client.

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"

Mettre à jour un client

Met à jour un client ; tous les champs sont facultatifs.

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"}'

Supprimer un client

Retire un client de l’usage actif ; il n’apparaît plus dans les listes ni les lectures.

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"

Transactions d’un client

Récupère les transactions pour un client donné.

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"

Réponse

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

Objet Customer

ChampTypeDescription
idstringIdentifiant client
organization_idstringOrganisation propriétaire
namestringNom complet
emailstringE-mail
phone_numberstringTéléphone
whatsapp_numberstringWhatsApp
countrystringPays
citystringVille
addressstringAdresse
postal_codestringCode postal
is_businessbooleanClient professionnel
metadataobjectMétadonnées
created_atstringCréation
updated_atstringDernière mise à jour

Réponses d’erreur

StatutDescription
400Données invalides
401Clé API invalide ou manquante
404Client introuvable ou accès refusé

Sur cette page