This is a creadit card validator and BIN Lookup rest API. I used Bintable's free BIN Lookup API and Luhn's algorithm to retrieve BIN data and check if a CC number is valid.
To use this API you need to get an API Key from bintables.com. All you need to do is register an account. Also you need to create a key.env file in the root of the path containing the PORT, API_KEY and BASE_URL keys
PORT="8080"
API_KEY="<YOUR_API_KEY>"
BASE_URL="https://api.bintable.com/v1/"
GET http://localhost:8080/v1/validate ENDPOINT
Checks if the given CC number is valid and returns BIN data if the account range (first 6 numbers) is found in the database
{
"credit_card_number": "324000xxxxxxxxxx"
}
{
"result": "Valid credit card number",
"data": {
"card_info": {
"scheme": "American express",
"type": "Debit",
"category": "Business"
},
"bank": {
"name": "BRANCH BANKING AND TRUST COMPANY",
"website": "http://www.bbt.com/"
"phone": "910-914-8250 OR 800-226-5228"
},
"country": {
"name": "United states of america",
"code": "us"
}
}
}
GET http://localhost:8080/v1/accountrng ENDPOINT
Returns all the BIN data of the account if the account range is found in the database
{
"account_range": "324000"
}
{
"result": "Valid account range",
"data": {
"card_info": {
"scheme": "American express",
"type": "Debit",
"category": "Business"
},
"bank": {
"name": "BRANCH BANKING AND TRUST COMPANY",
"website": "http://www.bbt.com/"
"phone": "910-914-8250 OR 800-226-5228"
},
"country": {
"name": "United states of america",
"code": "us"
}
}
}
You can also edit the API endpoints to return all the information returned by Bintable's REST API
{
"result": 200,
"message": "SUCCESS",
"data": {
"card": {
"scheme": "American express",
"type": "Debit",
"category": "Business",
"length": 15,
"checkluhn": 1,
"cvvlen": 4
},
"country": {
"name": "United states of america",
"code": "us",
"flag": "🇺🇸",
"currency": "United States dollar",
"currency_code": "USD"
},
"bank": {
"name": "BRANCH BANKING AND TRUST COMPANY",
"website": "http://www.bbt.com/",
"phone": "910-914-8250 OR 800-226-5228"
}
}
}