Introduction
BIN Lookup allows you to retrieve card information by providing the first 8 digits of a card number. This helps you identify card network, type, bank, and issuance details before processing a payment, enabling better user experience and payment flow optimization.Card Network Detection
Identify card network (visa, mastercard, rupay, etc.) instantly
Card Type Identification
Determine if the card is credit or debit
Bank Information
Get bank name and domestic/international status
Use Cases
- Pre-validation: Validate card details before submitting payment
- UI Enhancement: Display card network logo or bank name as user types
- Payment Flow Optimization: Determine payment method eligibility
- Fraud Prevention: Identify potentially suspicious cards early
Prerequisites
Before you begin, ensure you have:- Credentials: Your Client ID and Client Secret
- API Access: BIN lookup endpoint access enabled for your account
Step 1: Lookup BIN
Send a POST request to/pg/bin/ with the BIN code (first 8 digits of the card number).
Request Example
JavaScript Example
Python Example
Step 2: Handle Response
Success Response
Response Fields
- bank: Bank name that issued the card
- network: Card network - visa, mastercard, rupay, amex, diners, maestro, sbi_maestro
- card_type: Card type -
credit_cardordebit_card - is_domestic: Boolean indicating if card is issued in India
Error Handling
Integration Example: Real-time Card Detection
Here’s a complete example of integrating BIN lookup in a card input form:Best Practices
- Debounce Requests: Wait for user to stop typing before making BIN lookup requests
- Cache Results: Cache BIN lookup results to reduce API calls
- Handle Errors Gracefully: Don’t block payment flow if BIN lookup fails
- Validate BIN Format: Ensure BIN is 8 digits before making request
- Show Loading State: Display loading indicator during lookup
Error Codes
| Error Code | Description | Solution |
|---|---|---|
ERR_BIN_001 | Invalid BIN format | Ensure BIN is 8 digits |
ERR_AUTH_000 | Missing credentials | Check Client ID and Secret |
ERR_SERVICE_ERROR_000 | Service unavailable | Retry after a few seconds |