This is part of the IFSC toolset released by Razorpay. You can find more details about the entire release at [ifsc.razorpay.com](https://ifsc.razorpay.com). Includes only a validation library as of now.
npm install ifscThis is part of the IFSC toolset released by Razorpay.
You can find more details about the entire release at
ifsc.razorpay.com.
!Docker Image Version (latest semver)    
If you are just looking for the dataset, go to the [releases][releases] section and download the latest release.
The latest scraper workflow on GitHub should publish a release-artifact as well.
Various official sources are linked below, with the ones currently used marked with a †
- List of NEFT IFSCs from [RBI website][combined]†
- List of RTGS IFSCs from [RBI website][rtgs]†
- RBI maintains several lists:
- List of banks in India
- Websites of banks in India.
- Bankwise Volumes in ECS/NEFT/RTGS/Mobile
- List of Banks permitted to provide Mobile Banking
- NPCI website has several lists:
- [NACH Live Members][ach]†
- RuPay Live Members
- IMPS Live members
- Banks and Apps live on AutoPay
- Sub member banks IFSC and MICR Codes
- Merged banks IFSC and MICR Codes
- Routing codes used in API E-Mandates
- Merged Banks on NACH
- Blocked Banks on NACH
#### SWIFT
SWIFT/BIC codes are supported for a few banks.
##### SBI
- https://sbi.co.in/web/nri/quick-links/swift-codes †
- https://sbi.co.in/documents/16012/263663/sbinri_merged_bran_swfcodet.xlsx †
- Branch codes from above are checked against the SBI Branch Locator to get the IFSC.
##### PNB
- https://pnbindia.com/downloadprocess.aspx?fid=Zb7ImdUNlz9Ge73qn1nXQg== †
- https://www.pnbindia.in/document/PNB-helpdesk/bic_code.pdf †
##### HDFC
- https://www.hdfcbank.com/nri-banking/correspondent-banks †
Add this line to your application's Gemfile:
``ruby`
gem "ifsc"
And then execute:
`bash`
$ bundle
Or install it yourself as:
`bash`
$ gem install ifsc
Inside of your Ruby program do:
`ruby`
require "ifsc"
...to pull it in as a dependency.
composer require php-http/curl-client razorpay/ifsc
The PHP package has a dependency on the virtual package php-http/client-implementation which requires you to install an adapter, but we do not care which one. That is an implementation detail in your application. You do not have to use the php-http/curl-client if you do not want to. You may use the php-http/guzzle6-adapter. Read more about the virtual packages, why this is a good idea and about the flexibility it brings at the HTTPlug docs. You can find a list of suported providers on packagist.
The minimum PHP version supported is 7.3. The package can be installed on PHP>=7.1 however.
$ npm install ifsc
This package is compatible with modern Go releases in module mode, with Go installed:
go get github.com/razorpay/ifsc/v2
will resolve and add the package to the current development module, along with its dependencies.
Alternatively the same can be achieved if you use import in a package:
import "github.com/razorpay/ifsc/v2/src/go"
and run go get without parameters.
Finally, to use the top-of-trunk version of this repo, use the following command:
go get github.com/razorpay/ifsc/v2@master
Only the latest version of each SDK is considered.
| Language | Validation | API Client | Sublet Support (Custom) | Bank Constants |
| -------- | ---------- | ---------- | ----------------------- | -------------- |
| PHP | ✅ | ✅ | ✅ (✅) | ✅ |
| Ruby | ✅ | ✅ | ✅ (✅) | ✅ |
| Node.js | ✅ | ✅ | ❎ (❎) | ✅ |
| Go | ✅ | ✅ | ✅ (✅) | ✅ |
This repository also hosts the source code for 5 modules: PHP/Node.js/Ruby/Go as of now.
The API is documented below:
` use Razorpay\IFSC\Bank; IFSC::validate('KKBK0000261'); // Returns true IFSC::validateBankCode('PUNB'); // Returns true IFSC::getBankName('PUNB'); // Returns 'Punjab National Bank' IFSC::getBankName(Bank::PUNB); //Returns Punjab National Bank Bank::getDetails(Bank::PUNB); // Returns an array: $client = new Client(); echo $res->bank; // 'KOTAK MAHINDRA BANK LIMITED' // You will get a SWIFT code where possible: echo $client->lookupIFSC('https://ifsc.razorpay.com/HDFC0CAGSBK')->swift; // 'HDFCINBB' // lookupIFSC may throw phpRazorpay\IFSC\Exception\ServerError
use Razorpay\IFSC\IFSC;
use Razorpay\IFSC\Client;
IFSC::validate('BOTM0XEEMRA'); // Returns false
IFSC::validateBankCode('ABCD'); // Returns false
IFSC::getBankName('ABCD'); // Returns null
Bank::getDetails('PUNB');
// [
// 'code' => 'PUNB',
// 'type' => 'PSB',
// 'ifsc' => 'PUNB0244200',
// 'micr' => '110024001',
// 'iin' => '508568',
// 'apbs' => true,
// 'ach_credit' => true,
// 'ach_debit' => true,
// 'nach_debit' => true,
// 'name' => 'Punjab National Bank',
// 'bank_code' => '024',
// 'upi' => true
// ]
$res = $client->lookupIFSC('KKBK0000261');
echo $res->branch; // 'GURGAON'
echo $res->address; // 'KOTAK MAHINDRA BANK LTD. UNIT NO. 8&9, SEWA CORPORATE PARK, MG ROAD, REVENUE STATE OF SARHAUL TEHSIL, DISTT,- GURGAON- 122001'
echo $res->contact; // '4131000'
echo $res->city; // 'GURGAON'
echo $res->district; // 'GURGAON'
echo $res->state; // 'HARYANA'
echo $res->centre; // 'GURGAON'
echo $res->getBankCode(); // KKBK
echo $res->getBankName(); // 'Kotak Mahindra Bank'
echo $res->micr; // '110485003'
// Boolean fields: $res->upi, $res->rtgs, $res->neft, res->imps`
// in case of server not responding in time
// or Razorpay\IFSC\Exception\InvalidCode in case
// the IFSC code is invalid
`js
var ifsc = require('ifsc');
ifsc.validate('KKBK0000261'); // returns true
ifsc.validate('BOTM0XEEMRA'); // returns false
ifsc.fetchDetails('KKBK0000261').then(function(res) {
console.log(res);
// {
// MICR: '560226263',
// BRANCH: 'THE AGS EMPLOYEES COOP BANK LTD',
// ADDRESS: 'SANGMESH BIRADAR BANGALORE',
// STATE: 'KARNATAKA',
// CONTACT: '+91802265658',
// UPI: true,
// RTGS: true,
// CITY: 'BANGALORE',
// CENTRE: 'BANGALORE URBAN',
// DISTRICT: 'BANGALORE URBAN',
// NEFT: true,
// IMPS: true,
// SWIFT: 'HDFCINBB',
// BANK: 'HDFC Bank',
// BANKCODE: 'HDFC',
// IFSC: 'HDFC0CAGSBK'
// }
});
console.log(ifsc.bank.PUNB); // prints PUNB
// Prints the entire JSON from https://ifsc.razorpay.com/KKBK0000261
// res is an object, not string
`
Make sure you have require 'ifsc' in your code.
Validating a code offline. (Remember to keep the gem up to date!)
`rbvalid?
Razorpay::IFSC::IFSC.valid? 'KKBK0000261' # => true
Razorpay::IFSC::IFSC.valid? 'BOTM0XEEMRA' # => false
Razorpay::IFSC::IFSC.validate! 'KKBK0000261' # => true
Razorpay::IFSC::IFSC.validate! 'BOTM0XEEMRA' # => Razorpay::IFSC::InvalidCodeError
Razorpay::IFSC::Bank::PUNB
'PUNB'
`
Validate online and retrieve details from the server
If you call code.valid? before calling code.get, the validation will be performed offline.
`rb1. using find
code = Razorpay::IFSC::IFSC.find 'KKBK0000261'
`
#### Sublet Branches
You can use the code.bank_name method to get the bank name considering sublet branches.
`rb`
code = Razorpay::IFSC::IFSC.find 'HDFC0CKUB01'
code.bank_name "Khamgaon Urban Co-operative Bank"
This works offline, and doesn't need a network call. This information is stored across 2 files:
1. src/sublet.json - Autogenerated from the NPCI websitesrc/custom-sublets.json
2. - Maintained manually. Coverage is not 100%. PRs are welcome.
Sublet (or Sub-Member) branches are IFSC codes belonging to a large bank, but leased out to
smaller banks. In some cases, entire ranges are given to a specific bank.
For eg, all IFSCs starting with YESB0TSS belong to Satara Shakari Bank. These arecustom-sublets.json
maintained manually in .
#### Error handling
`rbRazorpay::IFSC::InvalidCodeErrorall these
for an invalid code
Razorpay::IFSC::IFSC.validate! '...'
Razorpay::IFSC::IFSC.find '...'
code = Razorpay::IFSC::IFSC.new '...'; code.get
if there is an error$3
`go
package mainimport (
ifsc "github.com/razorpay/ifsc/v2/src/go"
)
// todo: change funcs not required to lower case.
func main() {
ifsc.Validate("KKBK0000261") // Returns true
ifsc.Validate("BOTM0XEEMRA") // Returns false
ifsc.ValidateBankCode("PUNB") // Returns true
ifsc.ValidateBankCode("ABCD") // Returns false
ifsc.GetBankName("PUNB") // Returns "Punjab National Bank", nil
ifsc.GetBankName("ABCD") // Returns "", errors.New(invalid bank code)
ifsc.GetBankName(ifsc.HDFC) // Returns "HDFC Bank", nil
ifsc.GetBankDetails("PUNB")
// or
ifsc.GetBankDetails(ifsc.PUNB)
/* Returns
(*ifsc.Bank){
Name : "Punjab National Bank",
BankCode : "024",
Code : "PUNB",
Type : "PSB",
IFSC : "PUNB0244200",
MICR : "110024001",
IIN : "508568",
APBS : true,
AchCredit : true,
AchDebit : true,
NachDebit : true,
Upi : true
}), nil
*/
ifsc.LookUP("KKBK0000261")
/*
Returns
(*ifsc.IFSCResponse)({
Bank : "Kotak Mahindra Bank",
Branch : "GURGAON",
Address : "KOTAK MAHINDRA BANK LTD. UNIT NO. 8&9, SEWA CORPORATE PARK, MG ROAD, REVENUE STATE OF SARHAUL TEHSIL, DISTT,- GURGAON- 122001",
Contact : "4131000",
City : "GURGAON",
District : "GURGAON",
State : "HARYANA",
IFSC : "KKBK0000261",
BankCode : "KKBK"
}), nil
*/
}
`$3
Both the packages ship with a 300kb JSON file, that
includes the entire list of IFSC codes, in a compressed,
but human-readable format.
The Bank Code and Names list is maintained manually, but verified
with tests to be accurate as per the latest RBI publications. This
lets us add older Bank codes to the name list, without worrying
about them getting deleted in newer builds.
API Development
The IFSC API is maintained in a separate repository at .
License
The code in this repository is licensed under the MIT License. License
text is available in the
LICENSE` file. The dataset itself[combined]: https://rbidocs.rbi.org.in/rdocs/content/docs/68774.xlsx
[releases]: https://github.com/razorpay/ifsc/releases
[rtgs]: https://rbidocs.rbi.org.in/rdocs/RTGS/DOCs/RTGEB0815.xlsx
[ach]: https://www.npci.org.in/what-we-do/nach/live-members/live-banks