Validate an IBAN
Check an IBAN on Wajub's side before you save it, and read what a valid answer proves.
POST /identity/validate checks an IBAN's format, its length for its country and its checksum,
without contacting any bank.
curl https://api.wajub.com/identity/validate \
-H "Authorization: $WAJUB_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "iban": "FR14 2004 1010 0505 0001 3M02 606" }'The answer is flat. iban comes back normalised, which is the form to store.
{
"valid": true,
"iban": "FR1420041010050500013M02606"
}
Mistype one character, a final 7 for the 6, and the checksum no longer holds. The rejected IBAN
carries a message you can show as it is.
{
"valid": false,
"iban": "FR1420041010050500013M02607",
"message": "IBAN checksum is invalid."
}
Valid means well-formed, not that the account exists
A rejection is still a 200: branch on valid, not on the status code. And a valid checksum
proves the IBAN was typed correctly, nothing more. No bank has said the account is open.