Afriex SDK
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:

ChannelDescription
BANK_ACCOUNTBank transfer
MOBILE_MONEYMobile money (M-Pesa, MTN, etc.)
SWIFTInternational SWIFT 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

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 object

Parameters:

FieldTypeRequiredDescription
currencystringYesUSD, NGN, GBP, or EUR
labelstringNo*Descriptive label for the account
amountnumberNo*Specific transaction amount
customerIdstring-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: PaymentMethod

Pool 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.

On this page