Skip to Content
APIPayment Methods

Payment Methods API

Manage payment methods including 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", }, });

Payment Channels:

ChannelDescription
BANK_ACCOUNTBank transfer
MOBILE_MONEYMobile money (e.g., M-Pesa)
SWIFTSWIFT international transfer
UPIUnified Payments Interface (India)
INTERACInterac (Canada)
WE_CHATWeChat 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 (Banks/MoMo Providers)

Get a list of supported financial institutions for a country:

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 only available in production.

Get Virtual Account

Get or create a virtual bank account:

// Standard virtual account (default) const virtualAccount = await afriex.paymentMethods.getVirtualAccount({ currency: "USD", amount: 1000, // Optional customerId: "optional-customer-id", }); // Pool account — shared business pool for a customer's country const poolAccount = await afriex.paymentMethods.getVirtualAccount({ type: "POOL_ACCOUNT", currency: "NGN", country: "NG", amount: 5000, customerId: "customer-id", reference: "optional-ref", });

Parameters:

FieldTypeRequiredDescription
currencystringYesUSD, NGN, GBP, or EUR
typestring-VIRTUAL_ACCOUNT (default) or POOL_ACCOUNT
amountnumberYes for POOL_ACCOUNTTransaction amount
customerIdstringYes for POOL_ACCOUNTCustomer ID
countrystringYes for POOL_ACCOUNTISO 3166-1 alpha-2 country code
referencestring-Optional transaction reference

Virtual accounts are only available in production.