Skip to main content

Overview

The Miscellaneous class provides utility methods for accessing reference data like supported banks, countries, and states. This information is essential for building forms and validating user input.

Methods

listBanks

Get a list of all supported banks and their details. Use this to populate bank selection dropdowns and get bank codes for verification.
const result = await paystack.miscellaneous.listBanks({
  country: "nigeria",
  perPage: 50,
  use_cursor: false
});

if (result.data) {
  result.data.data.forEach(bank => {
    console.log(`${bank.name} - ${bank.code}`);
  });
}

Parameters

country
enum
required
The country to get banks for. Options: nigeria, ghana, kenya, south africa
perPage
number
default:"50"
Number of results per page (max: 100)
use_cursor
boolean
default:"false"
Use cursor-based pagination
pay_with_bank_transfer
boolean
Filter for banks that support pay with bank transfer
pay_with_bank
boolean
Filter for banks that support pay with bank
enabled_for_verification
boolean
Filter for banks that are enabled for account verification
next
string
Cursor for the next page (when using cursor pagination)
previous
string
Cursor for the previous page (when using cursor pagination)
gateway
enum
Filter by gateway type. Options: emandate, digitalBankMandate
type
string
Filter by bank type
currency
enum
Filter by currency. Options: NGN, USD, GHS, ZAR, KES, XOF
include_nip_sort_code
boolean
Include NIP sort code in the response

Response

status
boolean
Indicates whether the request was successful
message
string
A message describing the result
data
array
Array of bank objects

listCountries

Get a list of all supported countries and their configuration details.
const result = await paystack.miscellaneous.listCountries();

if (result.data) {
  result.data.data.forEach(country => {
    console.log(`${country.name} (${country.iso_code})`);
    console.log(`Default currency: ${country.default_currency_code}`);
  });
}

Parameters

This method takes no parameters.

Response

status
boolean
Indicates whether the request was successful
message
string
A message describing the result
data
array
Array of country objects

listStates

Get a list of all states in a specific country. Useful for address verification and form population.
const result = await paystack.miscellaneous.listStates({
  country: "NG"
});

if (result.data) {
  result.data.data.forEach(state => {
    console.log(`${state.name} (${state.abbreviation})`);
  });
}

Parameters

country
string
required
The country code (e.g., “NG” for Nigeria)

Response

status
boolean
Indicates whether the request was successful
message
string
A message describing the result
data
array
Array of state objects

Common Use Cases

Building a Bank Selection Form

// Get all Nigerian banks
const { data } = await paystack.miscellaneous.listBanks({
  country: "nigeria",
  enabled_for_verification: true
});

if (data) {
  const bankOptions = data.data.map(bank => ({
    label: bank.name,
    value: bank.code
  }));
  // Use bankOptions in your form
}

Address Verification

// Get all states in Nigeria for address validation
const { data } = await paystack.miscellaneous.listStates({
  country: "NG"
});

if (data) {
  const stateOptions = data.data.map(state => ({
    label: state.name,
    value: state.slug
  }));
  // Use stateOptions in your address form
}

Error Handling

All methods return a result object with data and error properties:
const result = await paystack.miscellaneous.listBanks({
  country: "nigeria"
});

if (result.error) {
  console.error('Failed to fetch banks:', result.error.flatten());
} else if (result.data) {
  console.log(`Found ${result.data.data.length} banks`);
}