Not registered yet?
Register now! It is easy and done in 1 minute and gives you access to special discounts and much more!
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!
Readily get the BIC for a given IBAN:
Just used it for an IBAN and it gave me the seemingly correct, valid BIC for it.
I do not know whether the page's conversion can readily be automated.
Found solution for all IBAN accounts (I think):
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.
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.
Their website states the BIC lookup is currently available for the following countries: Belgium, Germany, Netherlands, Luxembourg and Switzerland
A recent update added Austria and Liechtenstein support.
Excellent answer, this webservice saved my day! Thanks @Kiddo!
OpenIBAN is no longer reachable.
openiban is throwing me an "IBAN is not valid" error for a correct IBAN number I'm directly reading from a bank card (Switzerland)
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 can't access the 'usage of api' page. Could you just explain how you get the BIC for IBAN codes??
It's an anchor link, the content for API is on the same page. To answer your second question. For the Dutch banks I use a PHP script that looks up the BIC from the bank identifier part of the IBAN by using this array: gist.github.com/wilgert/7305244#file-dutch_banks-json. For Belgian banks I rely upon the webservice from this answer: stackoverflow.com/a/13137295/357601 For banks from other countries the service does not work yet.
@Wilgert - you should provide the information in your Answer. Or change your Answer to a comment. As you can see from jitsCode's comments, link-only answers have problems. That's why Stack Overflow generally does not want them.
I recommend improving your answer by adding a code example here.
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:
They have somewhat more flexible pricing plans.
$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
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/
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.
I checked the page but cannot see pricing. Do you have any idea how much it could cost ?
I had a look around and found that you can retrieve the banks name from the iban number with this php iban validator:
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:
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 ..
For Dutch banks I created this JSON: gist.github.com/wilgert/7305244#file-dutch_banks-json
The link to nbb.de is dead. :(