Check is Domestic Card API

The Check is Domestic or Card BIN API is used to detect whether a particular BIN number is international or domestic. It is also useful to determine:

  • Card's issuing bank
  • Card type such as, Visa, Master, etc.
  • Card category such as Credit/Debit, etc.
  • bin number is the first 6 digits of a Credit/Debit card.

Environment

Request header

ParameterDescription
dateThe current date and time. For example, format of the date is Wed, 28 Jun 2023 11:25:19 GMT.
authorizationThe actual HMAC signature generated using the specified algorithm (sha512) and includes the hashed data. For more information, refer to authorization fields description.

authorization fields description

FieldDescription
usernameRepresents the username or identifier for the client or merchant, for example smsplus.
algorithmUse SHA512 algorithm for hashing and send this as header value.
headersSpecifies which headers have been used in generating the hash, for example date.
signatureThe HMAC signature generated using the specified algorithm. For more information, refer to hashing algorithm.

hashing algorithm

You must hash the request parameters using the following hash logic:

Hash logic: sha512(<Body data> + '|' + date + '|' + merchant_secret)

Where <Body data> contains the request body posted with the request.

Sample header code
var merchant_key = 'smsplus';
var merchant_secret = 'izF09TlpX4ZOwmf9MvXijwYsBPUmxYHD';
// date
var date = new Date();
date = date.toUTCString();

// authorization
var authorization = getAuthHeader(date);

function getAuthHeader(date) {
    var AUTH_TYPE = 'sha512';
    var data = isEmpty(request['data']) ? "" : request['data'];
    var hash_string = data + '|' + date + '|' + merchant_secret;
    var hash = CryptoJS.SHA512(hash_string).toString(CryptoJS.enc.Hex);
    return `hmac username="${merchant_key}", algorithm="${AUTH_TYPE}", headers="date", signature="${hash}"`;
}

Request body

Parameter Description Example
bin
mandatory
Integer/String The first 6 digits of the card (i.e., the BIN number). 462273

Sample request

curl --location 'https://info.payu.in/issuing-bank/v1/bin?is_domestic=true' \
--header 'Content-Type: application/json' \
--header 'date: {{date}}' \
--header 'Authorization: {{authorization}}' \
--data '{
  "bin": "512345"
}'

Sample response


If the card is domestic

{
  "isDomestic": "Y",
  "issuingBank": "SCB",
  "cardType": "VISA",
  "cardCategory": "CC"
}

If the card is international

{
  "isDomestic": "N",
  "issuingBank": "UNKNOWN",
  "cardType": "Unknown",
  "cardCategory": "CC"
}

Response parameters

ParameterDescription
isDomesticResponse value can contain any of the following: • Y signifies that the particular BIN is domestic. • N signifies that the particular BIN is International.
cardTypeResponse value can contain any of the following: • MAST • VISA • MAES • AMEX • DINER • Unknown
issuingBankThe issuing bank of the card used for the transaction.
cardCategoryResponse value can contain any of the following: • CC signifies that the particular bin is a credit card BIN • DC signifies that the particular bin is a debit card BIN

To learn more about the possible error codes and their description, refer to Error Codes .



Important Notes:


  1. BIN Number: The var1 parameter should contain exactly the first 6 digits of the card number 2. Domestic vs International:- Domestic cards (isDomestic: "Y") will show detailed issuing bank information
    • International cards (isDomestic: "N") typically show "UNKNOWN" for issuing bank
    1. Card Types: The API supports detection of major card types including VISA, MAST, AMEX, MAES, DINER 4. Card Categories: Distinguishes between Credit Cards (CC) and Debit Cards (DC) 5. Hash Calculation: Use the sha512 algorithm with the format: key|command|var1|salt
      </Accordion>