Skip to content

mirstar13/go-ccvalidator

Repository files navigation

CCValidator

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.

REQUIREMENTS

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

KEY.ENV BODY

PORT="8080"
API_KEY="<YOUR_API_KEY>"
BASE_URL="https://api.bintable.com/v1/"

ENDPOINTS

Checks if the given CC number is valid and returns BIN data if the account range (first 6 numbers) is found in the database

REQUEST BODY

{
  "credit_card_number": "324000xxxxxxxxxx"
}

RESPONSE BODY

{
  "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"
    }
  }
}

Returns all the BIN data of the account if the account range is found in the database

REQUEST BODY

{
 "account_range": "324000"
}

RESPONSE BODY

{
   "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"
     }
   }
 }

EXTRA

You can also edit the API endpoints to return all the information returned by Bintable's REST API

DETAILED RESPONSE BODY

{
    "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"
        }
    }
}

About

Go CCValidator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published