@algora-ventures/bin-lookup
v1.0.5
Published
SDK for multiple projects
Downloads
70
Readme
@algora-ventures/bin-lookup
A simple and efficient Node.js library for looking up Bank Identification Numbers (BINs). This package allows you to retrieve information about a credit or debit card such as the issuing bank, card type, and country, based on the first few digits of the card number.
Installation
Install the package using npm:
npm install @algora-ventures/bin-lookupKeywords
- bin
- bin-lookup
- BIN lookup
- bank-identification-number
- credit-card
- card-issuer
- issuer-lookup
- payments
- card-brand
Usage
The library is easy to use. You need to create an instance of BinLookup and then you can use the lookup method to get the BIN details.
Here is a basic example:
import { BinLookup, type BinInfo } from "@algora-ventures/bin-lookup";
async function getBinData() {
try {
const binLookup = await BinLookup.create();
const cardBin = "457173"; // Example BIN
const binInfo: BinInfo | null = binLookup.lookup(cardBin);
if (binInfo) {
console.log("BIN Information:", binInfo);
} else {
console.log("BIN not found.");
}
} catch (error) {
console.error("Failed to initialize BinLookup:", error);
}
}
getBinData();BinInfo Type
The lookup method returns a BinInfo object with the following structure:
type BinInfo = {
bin: string;
brand: string;
type: string;
category: string;
issuer: string;
issuerPhone: string;
issuerUrl: string;
isoCode2: string;
isoCode3: string;
countryName: string;
};If the BIN is not found, the lookup method will return null.
