Customers API
Manage customers with KYC support.
Create Customer
const customer = await afriex.customers.create({
fullName: "John Doe",
email: "john@example.com",
phone: "+1234567890",
countryCode: "US",
meta: {
// Optional metadata
},
});Parameters:
| Field | Type | Required | Description |
|---|---|---|---|
fullName | string | Yes | Customer's full name |
email | string | Yes | Email address |
phone | string | Yes | Phone number with country code |
countryCode | string | Yes | ISO 3166-1 alpha-2 code, (e.g US) |
meta | object | - | Additional metadata |
The response uses name, not fullName — the API responds with a Customer object whose full-name field is name.
Get Customer
const customer = await afriex.customers.get("customer-id");List Customers
const response = await afriex.customers.list({
page: 0,
limit: 20,
email: "john@example.com",
phone: "+2348192837465",
});
console.log(response.data); // Customer[]
console.log(response.total); // Total countemail and phone are optional exact-match filters for narrowing the list.
Update Customer
Partially update a customer's profile. Send at least one of fullName, email, or phone; omitted fields are left unchanged.
const customer = await afriex.customers.update("customer-id", {
fullName: "Jane Doe",
});Update KYC
The KYC document map is sent directly as the request body — do not wrap it in a kyc field.
const customer = await afriex.customers.updateKyc("customer-id", {
PASSPORT: "AB123456",
DATE_OF_BIRTH: "1990-05-15",
COUNTRY: "NG",
});Valid keys: REPRESENTATIVE_TYPE, DATE_OF_BIRTH, ADDRESS, BANK_STATEMENT, BUSINESS_CERTIFICATE, COUNTRY, ID_FRONT, ID_BACK, PHONE, SELFIE, PROOF_OF_ADDRESS, PROOF_OF_INCOME, BVN, DRIVER_LICENSE, PASSPORT, NATIONAL_ID, PAYMENT_METHOD, RESIDENCE_PERMIT, VEHICLE_REGISTRATION, VOTER_ID, OTHERS.
Verify Customer
Run an identity verification against a customer document. Today the only supported docType is BVN (Nigeria). Verification is rate limited per business.
const customer = await afriex.customers.verify("customer-id", {
docType: "BVN",
docValue: "22222222222",
});Delete Customer
await afriex.customers.delete("customer-id");