API Reference
Payment Methods API
Manage bank accounts, mobile money, crypto wallets, and virtual accounts.
Create Payment Method
const paymentMethod = await afriex.paymentMethods.create({
channel: "BANK_ACCOUNT",
customerId: "customer-id",
accountName: "John Doe",
accountNumber: "1234567890",
countryCode: "NG",
institution: {
institutionCode: "044",
institutionName: "Access Bank",
},
});Supported Channels:
| Channel | Description |
|---|---|
BANK_ACCOUNT | Bank transfer |
MOBILE_MONEY | Mobile money (M-Pesa, MTN, etc.) |
SWIFT | International SWIFT transfer |
UPI | Unified Payments Interface (India) |
INTERAC | Interac (Canada) |
WE_CHAT | WeChat Pay (China) |
Get Payment Method
const paymentMethod = await afriex.paymentMethods.get("payment-method-id");List Payment Methods
const response = await afriex.paymentMethods.list({
page: 1,
limit: 20,
});Delete Payment Method
await afriex.paymentMethods.delete("payment-method-id");Get Institutions
List supported banks or mobile money providers:
const institutions = await afriex.paymentMethods.getInstitutions({
channel: "BANK_ACCOUNT",
countryCode: "NG",
});
// Returns: Institution[]
// { institutionId, institutionName, institutionCode }Resolve Account
Verify account details before creating a payment method:
const accountInfo = await afriex.paymentMethods.resolveAccount({
channel: "BANK_ACCOUNT",
accountNumber: "1234567890",
institutionCode: "044",
countryCode: "NG",
});
// Returns: { recipientName, recipientEmail, recipientPhone }Get Crypto Wallet
Get or create a crypto wallet address:
const response = await afriex.paymentMethods.getCryptoWallet({
asset: "USDT", // or 'USDC'
customerId: "optional-customer-id",
});
// Returns: { data: [{ address, network }], total, page }Crypto wallets are production-only.
List Virtual Accounts
Get existing virtual accounts for a customer:
const response = await afriex.paymentMethods.listVirtualAccounts({
customerId: "customer-id",
currency: "USD",
});
// Returns: { data: VirtualAccount[], total, page }Create Virtual Account
Generate a new virtual account:
// With fixed amount label
const account = await afriex.paymentMethods.createVirtualAccount({
currency: "USD",
label: "SALES",
customerId: "optional-customer-id",
});
// OR with specific amount
const account = await afriex.paymentMethods.createVirtualAccount({
currency: "NGN",
amount: 50000,
customerId: "customer-id",
});
// Returns single VirtualAccount objectParameters:
| Field | Type | Required | Description |
|---|---|---|---|
currency | string | Yes | USD, NGN, GBP, or EUR |
label | string | No* | Descriptive label for the account |
amount | number | No* | Specific transaction amount |
customerId | string | - | Optional customer ID to associate |
*Mutually exclusive: provide label OR amount, not both.
List Pool Accounts
Get the pool account for a supported country:
const poolAccount = await afriex.paymentMethods.listPoolAccounts({
customerId: "customer-id",
country: "NG",
});
// Returns: PaymentMethodPool accounts are shared across multiple customers in a country. Use the reference on the returned payment method to reconcile incoming deposits.
Virtual accounts and pool accounts are production-only.