Validate bank details before you pay out

A payout to a mistyped account either bounces days later or lands with a stranger. Checksums, bank lookups and a few cross-checks catch most of it at the moment someone types their details in.

Card mistakes are cheap. The processor declines, the customer retypes, the sale goes through a minute later. Bank transfer mistakes are not. A payout to a malformed account number can take days to come back, with a return fee attached, and a payout to a well-formed but wrong account may never come back at all. The money went where you told it to.

That asymmetry is why marketplaces, payroll tools and refund flows validate bank details at the moment the person types them, while that person is still on the page and can fix a digit. Three identifiers cover most of the world:

  • IBAN, the International Bank Account Number, used across Europe, the UK, much of the Middle East and beyond. It contains its own checksum.
  • SWIFT/BIC, an 8 or 11 character code identifying a bank (and optionally a branch) for international wires.
  • ABA routing number, the 9-digit US bank identifier, paired with a separate account number that has no public format.

Each has a different structure, a different checksum and different limits on what checking it can prove. This lesson works through all three, then combines them into a single payout-details check.

IBAN: two check digits that catch nearly every typo

An IBAN is a country code, two check digits, and a country-specific account part called the BBAN. GB29 NWBK 6016 1331 9268 19 breaks down as GB, check digits 29, then a UK BBAN made of a bank code (NWBK), a sort code (601613) and an account number (31926819).

The check digits come from a mod-97 calculation over the whole string. Move the first four characters to the end, turn letters into numbers (A=10 through Z=35), and the resulting very large integer must leave a remainder of 1 when divided by 97. That catches every single-character error and almost every transposition. On top of the checksum, each country fixes a total length (22 for the UK and Germany, 15 for Norway, up to 32 elsewhere) and a pattern for the BBAN, and some countries add their own national check digit inside the BBAN.

You could implement all of that. The checksum is easy; the per-country length and format table is the part that rots. IBAN Validator (ibanvalidator) keeps that table and runs every check for 2 credits a call.

Try it liveIBAN Validator2 credits
GEThttps://api.apiverve.com/v1/ibanvalidator
curl "https://api.apiverve.com/v1/ibanvalidator?iban=GB29+NWBK+6016+1331+9268+19" \
  -H "x-api-key: YOUR_API_KEY"
Sign in or create a free account to run this with your own key.

Spaces and lower case are accepted. isValid is the verdict; checks says which tests passed.

Now change one check digit, from 29 to 28:

Try it liveIBAN Validator2 credits
GEThttps://api.apiverve.com/v1/ibanvalidator
curl "https://api.apiverve.com/v1/ibanvalidator?iban=GB28NWBK60161331926819" \
  -H "x-api-key: YOUR_API_KEY"
Sign in or create a free account to run this with your own key.

isValid is false and errors explains why: the mod-97 checksum is wrong. checks.length and checks.format still pass.

The response separates the tests, and that separation is the useful part. checks.country, checks.length, checks.format and checks.checksum are booleans, checks.nationalCheckDigits is true, false or null (null where the country defines none), and errors is a list of human-readable reasons. Drop a digit from a German IBAN and you get three errors at once: wrong length for this country, the account part does not match the country's format, and a bad checksum. expectedLength tells you what the length should have been, which makes a far better form message than "invalid IBAN".

Paid plans add the decomposition: bban, bankCode, branchCode, accountNumber, expectedCheckDigits and isSEPA. isSEPA matters if you pay out in euros, because a SEPA-zone IBAN can receive a SEPA credit transfer, which is typically far cheaper than an international wire.

Check yourself

A seller enters an IBAN and the validator returns isValid: true. What has that established?

Answer the check above to continue.

Run every example on your own key. Free plan, no card.

Scaling up?

Volume pricing, custom SLAs, and dedicated support for high-traffic teams.

Contact sales