Is there any existing library or script I can use to generate the BIC code from an IBAN bank account number (and other necessary information)?
I've searched the web, but found only IBAN generators.
Thanks in advance!
Is there any existing library or script I can use to generate the BIC code from an IBAN bank account number (and other necessary information)?
I've searched the web, but found only IBAN generators.
Thanks in advance!
I do not think such library exists (at least for free).
The only reliable way to do this is by using the SWIFT IBAN Plus Directory (formely known as the SWIFT BICplusIBAN Directory.
This directory is provided by SWIFT, which is the IBAN registrar. With it you can match IBAN to various institutions information (including BIC).
The SWIFT IBAN Plus Directory is regularly updated by SWIFT with the latest data, is accessible as a file or via WebService APIs, and unfortunately is not available for free.
Found solution for all IBAN accounts (I think):
https://openiban.com/validate/IBAN_NUMBER?getBIC=true
If you make a CURL call for example to that URL, you will get the Account bank info for free. Replace IBAN_NUMBER
with your IBAN account.
Example:
`https://openiban.com/validate/DE89370400440532013000?getBIC=true`
Result:
{
"valid": true,
"messages": [],
"iban": "DE89370400440532013000",
"bankData": {
"bankCode": "37040044",
"name": "Commerzbank",
"zip": "50447",
"city": "Köln",
"bic": "COBADEFFXXX"
},
"checkResults": {}
}
OpenIBAN has shut down it's API service due to the GDPR regulations posing unknown risks on the service provider. See the statement on openIBAN.com. There is also a link to a self-hosting guide included, see this github page.
Solution for Belgian IBAN bank account numbers:
There exists a webservice for Belgian iban numbers, it's very easy to get the bic from the iban bank account number.
$client = new SoapClient('http://www.ibanbic.be/IBANBIC.asmx?WSDL');
$bban = $client->getBelgianBBAN(array('Value' => $iban))->getBelgianBBANResult;
$bic = $client->BBANtoBIC(array('Value' => $bban))->BBANtoBICResult;
I've searched for a dutch webservice aswell, but I couldn't find one. But you can always make one yourself with the data from http://www.betaalvereniging.nl/europees-betalen/sepa-documentatie/bic-afleiden-uit-iban/
$json_url = 'http://iban2bic.nl/api/'.$iban_number_of_dutch_bank;
$json = file_get_contents($json_url);
$data = json_decode($json, TRUE);
$bic = $data['bic']; // holds the BIC number
I created a Webservice that can convert both Dutch and Belgian IBAN to the corresponding BIC. More countries might be added in the future if that appears feasible.
Have a look at: http://iban2bic.nl
Usage of the api: http://iban2bic.nl/api/:iban
This website has been offline for a while. I have now open sourced the code here: https://bitbucket.org/wilgert/iban2bic
Disclaimer: the code is old and might contain bugs, stupid mistakes and/or security vulnerabilities. Furthermore the list of Dutch bank is far from complete because a large number of banks has been added since 2013.
I had a look around and found that you can retrieve the banks name from the iban number with this php iban validator:
http://code.google.com/p/php-iban/
But when you get there you would need an array with all the bank institution codes and corresponding BIC codes.
I think all the BIC codes can be found here:
http://www.nbb.be/doc/gg/Protocol/R_List_of_Codes_Current.pdf
but i'm not sure how you can link the IBAN bank code to the list of BIC codes.
Didn't find a readymade library tough ..
There is no simple way to 'generate' BIC from an IBAN as BICs are independent number not present in the IBAN. ( Some countries have a part of the BIC in the IBAN ).
There is a number of services providing such data. www.swift.com is a corporate service. Not very cheap though.
A good solution for small/medium businesses could be: https://www.iban.com/validation-api-v2.html
They have somewhat more flexible pricing plans.