https://github.com/khasanovbi/banksdb
https://github.com/khasanovbi/banksdb
bank bank-card bank-card-info bankcard-prefix banks-db bin card-info card-number payment-system
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/khasanovbi/banksdb
- Owner: khasanovbi
- License: mit
- Created: 2019-01-12T02:40:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-01T12:00:30.000Z (over 3 years ago)
- Last Synced: 2025-08-13T22:32:23.779Z (10 months ago)
- Topics: bank, bank-card, bank-card-info, bankcard-prefix, banks-db, bin, card-info, card-number, payment-system
- Language: Go
- Homepage:
- Size: 376 KB
- Stars: 16
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Banks DB
[](https://travis-ci.org/khasanovbi/banksdb)
[](https://pkg.go.dev/github.com/khasanovbi/banksdb/v2)
[](https://goreportcard.com/report/github.com/khasanovbi/banksdb)
[](https://github.com/khasanovbi/banksdb/releases/latest)
[](https://codecov.io/gh/khasanovbi/banksdb)
Community driven database to get bank info (name, brand, color, etc.) by bankcard prefix (BIN)
> This is golang port of [ramoona's banks-db](https://github.com/ramoona/banks-db).
### Install
```
go get -u github.com/khasanovbi/banksdb
```
### Usage
Below is an example which shows some common use cases for banksdb:
```go
package main
import (
"fmt"
"github.com/khasanovbi/banksdb/v2"
"github.com/khasanovbi/banksdb/v2/paymentsystem"
)
func main() {
for _, creditCard := range []string{"5275940000000000", "4111111111111111"} {
bank := banksdb.FindBank(creditCard)
paymentSystem := paymentsystem.FindPaymentSystem(creditCard)
fmt.Printf("CreditCard: %s\n", creditCard)
fmt.Printf("Bank info: %#v\n", bank)
if paymentSystem != nil {
fmt.Printf("Payment system: %s\n", *paymentSystem)
}
fmt.Println()
}
}
```
Output:
```
CreditCard: 5275940000000000
Bank info: &banksdb.Bank{Name:"citibank", Country:"ru", LocalTitle:"Ситибанк", EngTitle:"Citibank", URL:"https://www.citibank.ru/", Color:"#0088cf", Prefixes:[]int{419349, 427760, 427761, 520306, 527594}}
Payment system: MasterCard
CreditCard: 4111111111111111
Bank info: (*banksdb.Bank)(nil)
Payment system: Visa
```