Skip to content

IBAN and banks

import { validateIBAN, getBankFromIBAN, getBankInfo } from 'pakdatakit/iban'

A Pakistani IBAN is 24 characters: PK, two check digits, a four-letter bank code and a 16-digit account number. These functions check the format and checksum and name the bank.

validateIBAN() Valid

Bank
Standard Chartered Bank (Pakistan) Limited
Type
commercial
Active
Yes
import { validateIBAN, getBankFromIBAN, getBankInfo } from 'pakdatakit';
validateIBAN('PK36SCBL0000001123456702');
// → true
getBankFromIBAN('PK36 SCBL 0000 0011 2345 6702');
// → 'Standard Chartered Bank (Pakistan) Limited'
getBankInfo('MEZN');
// → {
// "code": "MEZN",
// "name": "Meezan Bank Limited",
// "type": "islamic",
// "active": true,
// "mergedInto": null,
// "aliasOf": null
// }
function validateIBAN(iban: string): boolean;

Parameters. iban: with or without spaces, any case.

Returns true when the IBAN is a Pakistani IBAN of the right length and its ISO 13616 mod-97 checksum is correct.

Related: getBankFromIBAN(), the IBAN checker.

function getBankFromIBAN(iban: string): string | null;

Returns the bank’s name for a valid IBAN, or null when the IBAN is invalid or the bank code is unknown.

function getBankInfo(ibanOrCode: string): BankInfo | null;
interface BankInfo {
code: string; // e.g. MEZN
name: string;
type: string; // 'commercial' | 'islamic' | 'microfinance' | 'digital' | 'emi' | ...
active: boolean;
mergedInto: string | null;
aliasOf: string | null;
}

Parameters. ibanOrCode: an IBAN or a four-letter bank code.

Returns the bank’s details, including whether it still operates and what it merged into.

Caveats. Bank codes are checked against real IBANs and the State Bank of Pakistan’s lists; see data sources.

Every function and type: the IBAN API reference.