API Reference
The Afriex SDK is organized into several service modules that map directly to the Afriex Business API.
Available Services
| Service | Description |
|---|---|
| Customers | Create and manage customers with KYC |
| Transactions | Create and track transactions |
| Payment Methods | Manage payment methods, banks, mobile money |
| Balance | Get organization wallet balances |
| Rates | Get exchange rates |
| Webhooks | Verify 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