Generate BIC from IBAN bank account number
Asked Answered
G

10

27

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.

Griffen answered 30/10, 2012 at 8:41 Comment(6)
There are some online generators, that's why I think it must be possible. ibanbicservice.nl ibannl.org/iban_check.php and moreGriffen
indeed. (I was misled by the fact that in Germany, multiple bank sortcodes can have the same BIC). They must look this up from an online source, as the BIC is (obviously) not encoded in the IBANFike
you can get the bank from the IBAN and the BIC from the bankAphid
@Dagon yes, but you have to look up the BIC from a list that you have to update frequently, or an online source.Fike
I have found a webserice for Belgian iban's, you can make it yourself with a list but the problem is that you have to update it frequently indeed.Griffen
For what it's worth, 5 years later someone found another nice service that looks quite promising. Check out this answerAzote
G
5

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/

Griffen answered 30/10, 2012 at 10:43 Comment(1)
NOTE: This website doesn't exist anymore.Frederik
C
34

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": {}
}

Important Update

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.

Update (2019/07/25)

Openiban is back online.

Cajolery answered 10/4, 2017 at 13:11 Comment(5)
Their website states the BIC lookup is currently available for the following countries: Belgium, Germany, Netherlands, Luxembourg and SwitzerlandAzote
A recent update added Austria and Liechtenstein support.Dismember
Excellent answer, this webservice saved my day! Thanks @Kiddo!Nomen
openiban is throwing me an "IBAN is not valid" error for a correct IBAN number I'm directly reading from a bank card (Switzerland)Jackofalltrades
openiban seems to be back online! "Update (2019/07/25) : Openiban is back online."Hallagan
P
11

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.

Prosecutor answered 2/7, 2013 at 22:19 Comment(1)
I checked the page but cannot see pricing. Do you have any idea how much it could cost ?Haeres
G
5

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/

Griffen answered 30/10, 2012 at 10:43 Comment(1)
NOTE: This website doesn't exist anymore.Frederik
P
2

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.

Phocine answered 5/11, 2013 at 9:50 Comment(4)
I can't access the 'usage of api' page. Could you just explain how you get the BIC for IBAN codes??Winnow
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: https://mcmap.net/q/498717/-generate-bic-from-iban-bank-account-number For banks from other countries the service does not work yet.Phocine
@Phocine - 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.Kermit
I recommend improving your answer by adding a code example here.Umpteen
H
2
 $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
Highflier answered 21/1, 2014 at 15:9 Comment(1)
NOTE: This website doesn't exist anymore.Frederik
C
1

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/

exert from above link

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 ..

Coon answered 30/10, 2012 at 10:20 Comment(2)
For Dutch banks I created this JSON: gist.github.com/wilgert/7305244#file-dutch_banks-jsonPhocine
The link to nbb.de is dead. :(Dismember
S
1

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.

Selfacting answered 16/11, 2016 at 11:34 Comment(0)
J
0

Readily get the BIC for a given IBAN:

https://www.ibancalculator.com/iban_validieren.html

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.

Jackofalltrades answered 15/4, 2019 at 11:5 Comment(0)
R
0

You can go around collecting lookup tables yourselves from the various national Bank authorities: https://www.bundesbank.de/en/tasks/payment-systems/services/bank-sort-codes/download-bank-sort-codes-626218 (Germany) so if you only have a few markets that might work. Or use openiban.

Rhachis answered 30/3, 2021 at 15:32 Comment(0)
L
0

This is a pretty old question and the scene has changed pretty much since then.

The selected answer covers only one country, however, if you need to cover all the countries that use IBAN, then I would suggest the IBAN API service to do so or any similar API.

[DISCLAIMER] I'm part of this service

Lodie answered 25/8, 2021 at 5:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.