Bank account forms (NUBAN)
Every Nigerian bank account number (NUBAN) has 10 digits, and the last digit is a check digit worked out from the bank’s CBN code and the first 9 digits. naija-data does that calculation, so you can catch a mistyped account number before you send money or call a paid API.
A payout form
Section titled “A payout form”- Show a bank dropdown of active banks that have a CBN code (so every choice can be checked).
- Check the account number against the chosen bank.
- Optionally, confirm the account name with your payment provider (how).
import { banks, getBank, isValidNuban, banksForNuban } from "naija-data";
// 1. Dropdown options: value = id, text = short nameconst options = banks() .filter((b) => b.cbn_code) .map((b) => ({ value: b.id, label: b.short_name ?? b.name }));
// 2. Check the account number for the chosen bank (id, CBN code or name all work)isValidNuban("0000014579", "first-bank"); // trueisValidNuban("0000014578", "first-bank"); // false: probably a typo
// Don't know the bank? List the banks the number could belong to.banksForNuban("0000014579").map((b) => b.name);
getBank("GTB")?.cbn_code; // "058"import naija_data as ng
options = [(b.id, b.short_name or b.name) for b in ng.banks() if b.cbn_code]
ng.is_valid_nuban("0000014579", "first-bank") # Trueng.is_valid_nuban("0000014578", "first-bank") # False[b.name for b in ng.banks_for_nuban("0000014579")]ng.get_bank("GTB").cbn_code # '058'import { z } from "zod";import { nubanWithBankSchema } from "naija-data/zod";
const Payout = nubanWithBankSchema(); // { account, bank }Payout.parse({ account: "0000014579", bank: "first-bank" }); // okPayout.safeParse({ account: "0000014578", bank: "first-bank" }).success; // false: "This account number is not valid for the selected bank."from django import formsfrom django_naija import forms as ngforms
class PayoutForm(ngforms.NUBANFormMixin, forms.Form): bank = ngforms.BankField() # banks with a CBN code account_number = ngforms.NUBANField() # checked against the chosen bankcurl "https://naija-data-api.asgatcreation.workers.dev/v1/validate/nuban?account=0000014579&bank=first-bank"# {"data": {"account": "0000014579", "bank": {...}, "valid": true}}curl "https://naija-data-api.asgatcreation.workers.dev/v1/validate/nuban?account=0000014579"# {"data": {"account": "0000014579", "candidates": [...]}}OPay, PalmPay and other wallets
Section titled “OPay, PalmPay and other wallets”OPay, PalmPay and similar wallets are not in the NUBAN check: they have no CBN bank code, and their account number is usually the customer’s phone number without its first 0. To accept them:
import { parsePhone } from "naija-data";
const looksLikeWallet = parsePhone("0" + "8031234567")?.type === "mobile"; // trueThen confirm the account with your payment provider, using the provider’s code for that wallet.
Good to know
Section titled “Good to know”- Bank status.
banks()returns active institutions only. PassactiveOnly = false/active_only=Falseto include banks that merged or lost their licence (each hasstatusandstatus_date). - Types.
typeis one ofcommercial,merchant,non_interest,payment_service_bank,mobile_money_operator,microfinance,mortgage,development_finance. - Codes.
cbn_code(3 digits for banks, 5 for others) is used for NUBAN;nip_code(6 digits) is the NIBSS instant-payment code where known. Codes confirmed by only one source are listed inunverified_fields. - Source: the CBN’s register of licensed financial institutions; codes cross-checked between providers.