• Stars
    star
    326
  • Rank 124,995 (Top 3 %)
  • Language
    HTML
  • License
    MIT License
  • Created over 8 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿฆ IFSC Codes Repository

ifsc

This 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) License: MIT npm version Gem Version PHP version

Dataset

If you are just looking for the dataset, go to the releases section and download the latest release.

The latest scraper workflow on GitHub should publish a release-artifact as well.

Source

Various official sources are linked below, with the ones currently used marked with a โ€ 

SWIFT

SWIFT/BIC codes are supported for a few banks.

SBI
PNB
HDFC

Installation

Ruby

Add this line to your application's Gemfile:

gem "ifsc"

And then execute:

$ bundle

Or install it yourself as:

$ gem install ifsc

Inside of your Ruby program do:

require "ifsc"

...to pull it in as a dependency.

PHP

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.

Node.js

$ npm install ifsc

Go

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

Support Matrix

Only the latest version of each SDK is considered.

Language Validation API Client Sublet Support (Custom) Bank Constants
PHP โœ… โœ… โœ… (โœ…) โœ…
Ruby โœ… โœ… โœ… (โœ…) โœ…
Node.js โœ… โœ… โŽ (โŽ) โœ…
Go โœ… โœ… โœ… (โœ…) โœ…

API Documentation

This repository also hosts the source code for 5 modules: PHP/Node.js/Ruby/Go as of now. The API is documented below:

PHP

<?php

use Razorpay\IFSC\Bank;
use Razorpay\IFSC\IFSC;
use Razorpay\IFSC\Client;

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'
IFSC::getBankName('ABCD'); // Returns null

IFSC::getBankName(Bank::PUNB); //Returns Punjab National Bank

Bank::getDetails(Bank::PUNB);
Bank::getDetails('PUNB');

// Returns an array:
// [
//    '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
// ]

$client = new Client();
$res = $client->lookupIFSC('KKBK0000261');

echo $res->bank; // 'KOTAK MAHINDRA BANK LIMITED'
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

// You will get a SWIFT code where possible:

echo $client->lookupIFSC('https://ifsc.razorpay.com/HDFC0CAGSBK')->swift; // 'HDFCINBB'

// lookupIFSC may throw `Razorpay\IFSC\Exception\ServerError`
// in case of server not responding in time
// or Razorpay\IFSC\Exception\InvalidCode in case
// the IFSC code is invalid

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

Ruby

Make sure you have require 'ifsc' in your code. Validating a code offline. (Remember to keep the gem up to date!)

# valid?

Razorpay::IFSC::IFSC.valid? 'KKBK0000261' # => true
Razorpay::IFSC::IFSC.valid? 'BOTM0XEEMRA' # => false

# validate!

Razorpay::IFSC::IFSC.validate! 'KKBK0000261' # => true
Razorpay::IFSC::IFSC.validate! 'BOTM0XEEMRA' # => Razorpay::IFSC::InvalidCodeError

# bank_name_for(code) gets you the bank name offline
Razorpay::IFSC::IFSC.bank_name_for 'PUNB0026200' -> "Punjab National Bank"
Razorpay::IFSC::IFSC.bank_name_for 'KSCB0006001' -> "Tumkur District Central Bank"

# get_details gets you the bank details from `banks.json`
Razorpay::IFSC::Bank.get_details 'PUNB'
{
   code: 'PUNB',
   type: 'PSB',
   ifsc: 'PUNB0244200',
   micr: '110024001',
   bank_code: '024',
   iin: '508568',
   apbs: true,
   ach_credit: true,
   ach_debit: true,
   nach_debit: true
}

# constants

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.

# 1. using find
code = Razorpay::IFSC::IFSC.find 'KKBK0000261'

# 2. using new(...).get
code = Razorpay::IFSC::IFSC.new 'KKBK0000261'
code.get

# result
code.valid?
# => true
code.bank
# => "Kotak Mahindra Bank"
code.branch
# => "GURGAON"
code.address
# => "KOTAK MAHINDRA BANK LTD. UNIT NO. 8&9, SEWA CORPORATE PARK, MG ROAD, REVENUE STATE OF SARHAUL TEHSIL, DISTT,- GURGAON- 122001"
code.contact
# => "4131000"
code.city
# => "GURGAON"
code.district
# => "GURGAON"
code.state
# => "HARYANA"
code.centre
# => GURGAON
code.neft
# => true
code.upi
# => true
code.imps
# => true
code.rtgs
# => true
code.swift
# => ""

Sublet Branches

You can use the code.bank_name method to get the bank name considering sublet branches.

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 website
  2. src/custom-sublets.json - 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 are maintained manually in custom-sublets.json.

Error handling

# all these `Razorpay::IFSC::InvalidCodeError` for an invalid code
Razorpay::IFSC::IFSC.validate! '...'
Razorpay::IFSC::IFSC.find '...'
code = Razorpay::IFSC::IFSC.new '...'; code.get

# these raise `Razorpay::IFSC::ServerError` if there is an error
# communicating with the server
Razorpay::IFSC::IFSC.find '...'
code = Razorpay::IFSC::IFSC.new '...'; code.get

Go

package main

import (
	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
	 */
}

Code Notes

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 https://github.com/razorpay/ifsc-api.

License

The code in this repository is licensed under the MIT License. License text is available in the LICENSE file. The dataset itself is under public domain.

More Repositories

1

blade

Design System that powers Razorpay
TypeScript
436
star
2

go-financial

A go port of numpy-financial functions and more.
Go
301
star
3

razorpay-php

Razorpay PHP Library
PHP
169
star
4

razorpay-node

Razorpay node.js bindings
JavaScript
146
star
5

razorpay-python

Razorpay Python SDK
Python
146
star
6

devstack

Razorpay DevX cloud on laptop solution
Go
125
star
7

react-native-razorpay

React Native wrapper for Razorpay's mobile SDKs
Java
119
star
8

razorpay-flutter

Razorpay Flutter Plugin
Dart
105
star
9

razorpay-android-sample-app

Sample app demonstrating integration of Razorpay checkout
Java
86
star
10

ifsc-api

๐Ÿฆ Standalone API for IFSC codes
CSS
75
star
11

concierge

Web Management & Secure Access Control of AWS Security Groups. Allows you to create IP leases for incoming connections to AWS instances. Also, allows creating invites to allow guest access by URL/Email Invites.Uses two factor authentication for additional security.
Go
68
star
12

razorpay-ruby

Razorpay Ruby SDK
Ruby
62
star
13

react-native-apollo-devtools

Flipper plugin to debug apollo client cache for React Native
TypeScript
57
star
14

razorpay-cordova

Cordova wrapper around Razorpay's Android and iOS SDKs
Shell
51
star
15

razorpay-java

Razorpay Java SDK
Java
50
star
16

metro

The Service Bus!
Go
48
star
17

shubhcron

A drop-in cron replacement that can run your jobs on auspicious timings.
Go
44
star
18

razorpay-woocommerce

Razorpay Payment Extension for Woocommerce
PHP
40
star
19

public-presentations

A curated list of public talks and articles by Razorpay
39
star
20

razorpay-go

Razorpay Go SDK
Go
33
star
21

alohomora

alohomora is razorpay's secret distribution system
Python
31
star
22

razorpay-php-testapp

Sample App for Razorpay PHP Integration
PHP
27
star
23

razorpay-magento

Razorpay Payment Extension for Magento
PHP
27
star
24

trino-gateway

Traffic routing for Trino Clusters
Go
24
star
25

razorpay-pod

๐Ÿ“ฑ CocoaPod implementation of Razorpay's Payment SDK. Refer for instructions:
Objective-C
22
star
26

razorpay-python-testapp

Razorpay test app for python
HTML
18
star
27

razorpay-cordova-sample-app

๐Ÿ“ฑ Razorpay Sample Application for Cordova, Ionic v1 and Ionic v2
JavaScript
16
star
28

opensource.razorpay.com

Razorpay Open Source showcase website
TypeScript
16
star
29

razorpay-opencart

Razorpay Payment Extension for Opencart
PHP
16
star
30

razorpay-whmcs

Razorpay Payment Extension for WHMCS
PHP
15
star
31

i18nify

Javascript library for internationalisation
TypeScript
14
star
32

razorpay-ios-sample-app

๐Ÿ“ฑ Sample app demonstrating integration of Razorpay iOS Framework
Objective-C
14
star
33

razorpay-android-custom-sample-app

Sample app to demonstrate the custom UI integration
Kotlin
13
star
34

razorpay-dot-net

Razorpay .NET SDK
C#
13
star
35

razorpay-edd

Razorpay plugin for Wordpress Easy Digital Downloads
PHP
11
star
36

razorpay-prestashop

Prestashop plugin for Razorpay
PHP
11
star
37

bhadra

Bhadra is a Vulnerability Management Platform to handle all security issues
HTML
11
star
38

razorpay-dotnet-testapp

Test app for .net integration
ASP.NET
10
star
39

lytics.js

Simpler analytics using HTML attributes.
JavaScript
10
star
40

razorpay-cscart

Razorpay Payment Extension for CS Cart
PHP
10
star
41

razorpay-capacitor

Capacitor wrapper around Razorpay's Android and iOS SDKs
TypeScript
10
star
42

razorpay-arastta

Razorpay Payment Extension for Arastta stores
PHP
9
star
43

sorting-hat

Post new signup data to Slack using the clearbit API
Ruby
8
star
44

razorpay-quick-payments

Razorpay Quick Payments plugin for WordPress
PHP
8
star
45

razorpay-woocommerce-subscriptions

Razorpay WooCommerce Subscriptions Plugin
PHP
6
star
46

razorpay-java-testapp

Sample app for Razorpay Java Integration
Java
5
star
47

darts

๐ŸŽฏ The Razorpay Dart Board Championship Hall of Fame
HTML
5
star
48

terraform-aws-ssl-ciphers

Common SSL Negotiation Policies to be used with AWS ELBs using Terraform
HCL
5
star
49

common-frontend-utils

Common Frontend Utils
JavaScript
5
star
50

component.js

Simple and Opinionated way to build UI Components
JavaScript
5
star
51

wercker-ubuntu14.04-ansible1.6

Ubuntu 14.04 with Ansible 1.6 box for http://wercker.com/
5
star
52

gollum-setup

Scripts to help you setup gollum
Ruby
3
star
53

teamcolony-rss

RSS Feed generator for teamcolony reports
Ruby
3
star
54

razorpay-customui-pod

iOS CustomUI SDK of Razorpay
Objective-C
3
star
55

kong-template

Kong template for plugin development
Lua
3
star
56

.github

Razorpay's Public Profile Page
3
star
57

razorpay-flutter-customui

Razorpay Flutter Plugin for Customui
Dart
2
star
58

cryptocows-whitepaper

Technical Documentation for Razorpay CryptoCows
2
star
59

ftx-hackathon

Wiki for the FTX Hackathon
2
star
60

citadel

Documentation Platform
JavaScript
1
star
61

etcd-backup

Docker file for etcd-backup running as a k8s cron job.
Shell
1
star
62

go-openssl

OpenSSL bindings for Golang
Go
1
star
63

dot-settings

JavaScript
1
star
64

subscriptions-magento-plugin

Subscriptions plugin for magento.
PHP
1
star
65

RazorpaySalesDemo

CSS
1
star
66

payment-button-wordpress-plugin

Payment button plugin for wordpress.
PHP
1
star
67

omnipay-razorpay

Razorpay plugin for Omnipay Payment Processing Library
PHP
1
star