Skip to Content
APIAPI Reference

API Reference

The Afriex SDK is organized into several service modules that map directly to the Afriex Business API.

Available Services

ServiceDescription
CustomersCreate and manage customers with KYC
TransactionsCreate and track transactions
Payment MethodsManage payment methods, banks, mobile money
BalanceGet organization wallet balances
RatesGet exchange rates
WebhooksVerify webhook signatures

Authentication

All API requests require the x-api-key header:

const afriex = new AfriexSDK({ apiKey: 'your-api-key' });

Error Handling

The SDK throws typed errors that you can catch:

import { AfriexSDK, ApiError, ValidationError, NetworkError } from '@afriex/sdk'; try { await afriex.customers.create({ ... }); } catch (error) { if (error instanceof ValidationError) { console.log('Validation failed:', error.errors); } else if (error instanceof ApiError) { console.log('API error:', error.statusCode, error.message); } else if (error instanceof NetworkError) { console.log('Network error:', error.message); } }
Last updated on