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
Environment | URL |
---|---|
Test Environment | https://test.payu.in/issuing-bank/v1/bin |
Production Environment | https://info.payu.in/issuing-bank/v1/bin |
Request header
Parameter | Description |
---|---|
date | The current date and time. For example, format of the date is Wed, 28 Jun 2023 11:25:19 GMT. |
authorization | The 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
Field | Description |
---|---|
username | Represents the username or identifier for the client or merchant, for example smsplus. |
algorithm | Use SHA512 algorithm for hashing and send this as header value. |
headers | Specifies which headers have been used in generating the hash, for example date. |
signature | The 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 |
---|---|---|
binmandatory |
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
Parameter | Description |
---|---|
isDomestic | Response value can contain any of the following: • Y signifies that the particular BIN is domestic. • N signifies that the particular BIN is International. |
cardType | Response value can contain any of the following: • MAST • VISA • MAES • AMEX • DINER • Unknown |
issuingBank | The issuing bank of the card used for the transaction. |
cardCategory | Response 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:
- 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
- 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>