Skip to main content
This page documents the key data models returned and accepted by the API, including all enumerated values and field-level details.

Customer

FieldTypeDescription
customerIdstringUnique identifier for the customer
fullNamestringFull name of the customer
emailstring (email)Email address
phonestringPhone number in E.164 format (e.g. +2348192837465)
countryCodestringISO 3166-1 alpha-2 country code (e.g. NG)
kycobjectOptional KYC document details
metaobjectOptional metadata you attach to the customer

Transaction

FieldTypeDescription
transactionIdstringUnique identifier for the transaction
customerIdstringID of the customer who owns this transaction
destinationIdstringID of the destination payment method
sourceAmountstringAmount debited from the source wallet
sourceCurrencystringISO 4217 currency code of the source wallet (e.g. USD)
destinationAmountstringAmount credited to the destination
destinationCurrencystringISO 4217 currency code of the destination (e.g. NGN)
typestringTransaction type. See Transaction Types
statusstringCurrent status. See Transaction Statuses
metaobjectMetadata attached to the transaction. See TransactionMeta
createdAtstring (ISO 8601)Timestamp when the transaction was created
updatedAtstring (ISO 8601)Timestamp of the last update

Transaction Types

ValueDescription
WITHDRAWSend funds from the Afriex wallet to a recipient’s payment method
DEPOSITReceive funds into the Afriex wallet
SWAPConvert funds between currencies within the Afriex wallet

Transaction Statuses

StatusDescription
PENDINGTransaction has been received and is awaiting processing
PROCESSINGTransaction is actively being processed
COMPLETEDTransaction completed successfully
SUCCESSAlias for a successfully settled transaction
FAILEDTransaction failed. Check the meta for details.
CANCELLEDTransaction was cancelled before processing
REFUNDEDFunds were returned to the sender
IN_REVIEWTransaction is under manual review
REJECTEDTransaction was rejected after review
RETRYTransaction is being automatically retried
UNKNOWNStatus could not be determined. Contact support.
Subscribe to Transaction Events to receive real-time status updates instead of polling the API.

TransactionMeta

The meta object passed when creating a transaction. idempotencyKey and reference are required.
FieldTypeRequiredDescription
idempotencyKeystringYesUnique key to prevent duplicate transactions. Use a UUID or your own unique identifier.
referencestringYesYour internal reference for the transaction (e.g. order ID)
merchantIdstringNoYour merchant or business identifier, used for reconciliation
narrationstringNoHuman-readable reason or description for the transaction
invoicestringNoBase64-encoded invoice document to attach to the transaction
{
  "meta": {
    "idempotencyKey": "550e8400-e29b-41d4-a716-446655440000",
    "reference": "ORDER-12345",
    "merchantId": "MERCHANT-001",
    "narration": "Payment for invoice #12345",
    "invoice": "base64EncodedStringHere"
  }
}
Always provide a unique idempotencyKey per transaction attempt. If you retry a failed request with the same key, Afriex will return the original transaction instead of creating a duplicate.

PaymentMethod

FieldTypeDescription
paymentMethodIdstringUnique identifier for the payment method
customerIdstringID of the customer who owns this payment method
channelstringPayment channel. See Payment Channels
countryCodestringISO 3166-1 alpha-2 country code
accountNamestringName of the account holder
accountNumberstringAccount number or phone number
institutionobjectBank or provider details. See PaymentMethodInstitution
metaobjectOptional metadata attached to the payment method

Payment Channels

ChannelDescription
BANK_ACCOUNTLocal bank account transfer
MOBILE_MONEYMobile money wallet (e.g. M-Pesa, MTN MoMo)
SWIFTInternational SWIFT wire transfer
UPIUnified Payments Interface (India)
INTERACInterac e-Transfer (Canada)
WE_CHATWeChat Pay

PaymentMethodInstitution

FieldTypeDescription
institutionIdstringUnique ID of the bank or mobile money provider
institutionNamestringDisplay name of the institution
institutionCodestringInstitution code (e.g. bank code)
institutionAddressstringPhysical address of the institution, if required
Use the List Institutions endpoint to retrieve valid institutions for a given country and channel.

Error Response

All API errors return a consistent JSON body:
FieldTypeDescription
codestringMachine-readable error code (e.g. AUTHENTICATION_ERROR)
errorstringShort error category (e.g. Bad Request)
details.errorMessagestringSpecific error reason (e.g. PHONE_COUNTRY_MISMATCH)
details.friendlyMessagestringUser-friendly message you can display to end users
{
  "code": "INVALID_BUSINESS_CUSTOMER_REQUEST",
  "error": "Bad Request",
  "details": {
    "errorMessage": "PHONE_COUNTRY_MISMATCH",
    "friendlyMessage": "The phone number does not match the customer's country."
  }
}

Common error codes

CodeHTTP StatusDescription
AUTHENTICATION_ERROR401API key is missing or invalid
INVALID_BUSINESS_CUSTOMER_REQUEST400Customer request validation failed
PHONE_COUNTRY_MISMATCH400Phone number country does not match countryCode
NOT_FOUND404The requested resource does not exist
RATE_LIMIT_EXCEEDED429Too many requests. Slow down and retry with backoff.