Skip to main content
POST
/
pg
/
bin
BIN Lookup
curl --request POST \
  --url https://api-pacb-uat.eximpe.com/pg/bin/ \
  --header 'Content-Type: application/json' \
  --header 'X-API-Version: <api-key>' \
  --header 'X-Client-ID: <api-key>' \
  --header 'X-Client-Secret: <api-key>' \
  --header 'X-Merchant-ID: <api-key>' \
  --data '
{
  "bin": "41111111"
}
'
{
  "success": true,
  "message": "BIN lookup successful",
  "data": {
    "bank": "hdfc bank",
    "network": "visa",
    "card_type": "credit_card",
    "is_domestic": true
  }
}

Overview

The BIN Lookup endpoint allows you to retrieve card information by providing the first 8 digits of a card number (BIN). This is useful for identifying card details before processing a payment, enabling you to:
  • Determine card network (visa, mastercard, rupay, amex, etc.)
  • Identify card type (credit or debit)
  • Get bank information
  • Check if the card is domestic or international
This endpoint helps you provide better user experience by pre-validating card information and displaying appropriate payment options.

Use Cases

  • Pre-validation: Validate card details before submitting payment
  • UI Enhancement: Show card network logo or bank name as user types
  • Payment Flow Optimization: Determine payment method eligibility based on card type
  • Fraud Prevention: Identify potentially suspicious cards before processing

Request

Endpoint

POST /pg/bin/

Headers

HeaderRequiredDescription
X-Client-IDYesYour Client ID
X-Client-SecretYesYour Client Secret
X-Merchant-IDConditionallyRequired for PSP merchants managing multiple merchant accounts
`X-API-Version: V3 (e.g., “v3.0.0”))
Content-TypeYesMust be application/json

Request Body

ParameterTypeRequiredDescriptionConstraints
binstringYesBIN code (first 8 digits of card number)Pattern: ^[0-9]{6,9}$

Example Request

curl -X POST https://api-pacb-uat.eximpe.com/pg/bin/ \
  -H "Content-Type: application/json" \
  -H "X-Client-ID: your-client-id" \
  -H "X-Client-Secret: your-client-secret" \
  -d '{
    "bin": "41111111"
  }'

Response

Success Response (200 OK)

{
  "success": true,
  "message": "BIN lookup successful",
  "data": {
    "bank": "hdfc bank",
    "network": "visa",
    "card_type": "credit_card",
    "is_domestic": true
  }
}

Response Fields

FieldTypeDescription
successbooleanIndicates if the request was successful
messagestringResponse message
dataobjectBIN lookup data
data.bankstringBank name that issued the card
data.networkstringCard network (visa, mastercard, rupay, amex, diners, maestro, sbi_maestro)
data.card_typestringCard type (credit_card or debit_card)
data.is_domesticbooleanWhether the card is domestic (issued in India) or international

Error Responses

400 Bad Request - Invalid BIN

{
  "success": false,
  "error": {
    "code": "ERR_BIN_001",
    "message": "Validation error",
    "details": {
      "bin": "BIN code must be 8 digits"
    }
  }
}

401 Unauthorized

{
  "success": false,
  "error": {
    "code": "ERR_AUTH_000",
    "message": "Missing credentials",
    "details": {
      "authentication": "Missing credentials."
    }
  }
}

500 Internal Server Error

{
  "success": false,
  "error": {
    "code": "ERR_SERVICE_ERROR_000",
    "message": "Payment gateway error",
    "details": {
      "error": "An unexpected error occurred. Please try again later"
    }
  }
}

Examples

JavaScript/TypeScript

async function lookupBIN(binCode) {
  const response = await fetch('https://api-pacb-uat.eximpe.com/pg/bin/', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-Client-ID': 'your-client-id',
      'X-Client-Secret': 'your-client-secret'
    },
    body: JSON.stringify({
      bin: binCode
    })
  });

  const data = await response.json();
  
  if (data.success) {
    console.log('Network:', data.data.network);
    console.log('Card Type:', data.data.card_type);
    console.log('Bank:', data.data.bank);
    console.log('Domestic:', data.data.is_domestic);
  } else {
    console.error('Error:', data.error);
  }
  
  return data;
}

// Usage
lookupBIN('41111111');

Python

import requests

def lookup_bin(bin_code):
    url = "https://api-pacb-uat.eximpe.com/pg/bin/"
    headers = {
        "Content-Type": "application/json",
        "X-Client-ID": "your-client-id",
        "X-Client-Secret": "your-client-secret"
    }
    payload = {
        "bin": bin_code
    }
    
    response = requests.post(url, json=payload, headers=headers)
    data = response.json()
    
    if data.get("success"):
        bin_data = data["data"]
        print(f"Network: {bin_data.get('network')}")
        print(f"Card Type: {bin_data.get('card_type')}")
        print(f"Bank: {bin_data.get('bank')}")
        print(f"Domestic: {bin_data.get('is_domestic')}")
    else:
        print(f"Error: {data.get('error')}")
    
    return data

# Usage
lookup_bin("41111111")

Notes

  • BIN code must be 8 digits
  • The endpoint returns null values for fields that cannot be determined
  • Card network values (visa, mastercard, etc.)
  • Bank names are returned
  • is_domestic is true for cards issued in India, false for international cards

Authorizations

X-Client-ID
string
header
required

Client Application ID - Your unique application identifier used to authenticate API requests. You can find your Client ID in the Developer Settings section of the merchant dashboard.

X-Client-Secret
string
header
required

Client Secret Key - Your secret key used alongside the Client ID for secure authentication. Keep this confidential and never expose it in client-side code. Available in the Developer Settings section of the merchant dashboard.

X-Merchant-ID
string
header
required

Merchant Identifier - The unique ID for the merchant account. This is required for PSP (Payment Service Provider) merchants who manage multiple merchant accounts. You can find merchant IDs in the Merchant Management section of the dashboard.

X-API-Version
string
header
required

API Version - Specifies which version of the API to use (e.g., '1.X.X', '2.X.X', or '3.X.X'). This header allows you to control which API version your integration uses. Default version information is available in the Developer Settings.

Body

application/json

BIN lookup request

bin
string
required

BIN code (first 6-8 digits of card number)

Pattern: ^[0-9]{6,9}$
Example:

"41111111"

Response

BIN lookup successful

success
boolean
required

Indicates if the request was successful

message
string
required

Response message

data
object
required