TCONNECT
Blog

BIN/IIN lookup: validate and identify payment cards inside your app

A BIN/IIN lookup identifies the card type, issuing bank and country from just the first 6 to 9 digits. Learn how to use a BIN lookup API to improve UX and reduce fraud.

T
TCONNECT Team January 20, 2026· 4 min read

What is a BIN/IIN?

The BIN (Bank Identification Number), also called the IIN (Issuer Identification Number), is the first 6 to 9 digits of a payment card. These digits identify:

  • The issuer: which bank issued the card (Vietcombank, BIDV, Techcombank, and so on)
  • The card network: Visa, Mastercard, Napas, JCB, Amex
  • The card level: Debit, Credit, Prepaid
  • The issuing country: Vietnam, United States, Singapore, and so on

For example, a card starting with 970436 is a Vietcombank card, while 970415 is Vietinbank.


Real-world uses of BIN lookup

1. Better UX when entering a card

When a user types a card number, call a BIN lookup after the first 6 digits to:

  • Show the issuing bank's logo
  • Automatically pick the right payment processor
  • Validate the card number format per network (Visa: 16 digits, Amex: 15 digits)
// Component nhập số thẻ: tự động nhận diện loại thẻ khi người dùng nhập
function CardInput():
    state cardInfo = null
 
    function handleCardChange(value):
        digits = strip_non_digits(value)
 
        // Gọi BIN lookup sau 6 số
        if digits.length >= 6 and cardInfo is null:
            bin  = first 9 digits of digits
            info = fetch_bin_info(bin)
            set cardInfo = info
 
        if digits.length < 6:
            set cardInfo = null
 
    render:
        text input (placeholder="Số thẻ", maxLength=19,
                    onChange → handleCardChange)
 
        if cardInfo is not null:
            display bank logo from cardInfo.bank_logo_url
            display cardInfo.card_type + " · " + cardInfo.card_level

2. Smart routing

For merchants with multiple payment gateways, use the BIN to route to the best processor:

function get_optimal_processor(bin_code):
    bin_info = lookup_bin(bin_code)
 
    // Thẻ nội địa Napas → cổng nội địa (phí thấp hơn)
    if bin_info.network == "NAPAS":
        return "domestic_processor"
 
    // Thẻ quốc tế → cổng quốc tế
    if bin_info.issuer_country != "VN":
        return "international_processor"
 
    // Thẻ tín dụng nội địa → có thể trả góp
    if bin_info.card_type == "CREDIT":
        return "installment_enabled_processor"
 
    return "default_processor"

3. Preliminary fraud detection

function preliminary_fraud_check(bin_code, user_country):
    bin_info = lookup_bin(bin_code)
 
    // Thẻ phát hành tại quốc gia khác với quốc gia người dùng
    if bin_info.issuer_country != user_country:
        flag_for_review("country_mismatch", bin_code, user_country)
        return true
 
    // Thẻ prepaid có rủi ro cao hơn
    if bin_info.card_level == "PREPAID":
        flag_for_review("prepaid_card", bin_code)
 
    return false

4. Show the right processing fee

Card processing fees differ by type:

Card typeTypical fee
Domestic debit (Napas)0.5 – 1.1%
Domestic credit1.3 – 1.8%
International Visa/Master debit1.5 – 2.2%
International Visa/Master credit2.0 – 3.0%
Amex2.5 – 3.5%
function get_processing_fee(bin_code, amount):
    bin_info = lookup_bin(bin_code)
    fee_rate = FEE_RATES[bin_info.network][bin_info.card_type]
    fee      = round(amount * fee_rate)
    return {
        amount:    amount,
        fee:       fee,
        fee_rate:  fee_rate,
        total:     amount + fee,
        card_type: bin_info.card_type,
        network:   bin_info.network
    }

Calling the TCONNECT BIN Lookup API

// Tra cứu thông tin BIN/IIN từ 6-9 số đầu của thẻ
function lookup_bin(bin_code, partner_code, access_token):
    payload   = { bin: bin_code }
    encrypted = encrypt_payload(payload, AES_KEY)
 
    POST https://sme-open-api-sandbox.tconnect.vn/openapi/v1/bin/lookup
        body: { data: encrypted }
        headers:
            Authorization: "Bearer {access_token}"
            Partner-Code: partner_code
 
    return decrypt_response(response.data, AES_KEY)

The response:

{
  "bin": "970436",
  "bank_name": "Ngân hàng TMCP Ngoại thương Việt Nam",
  "bank_short_name": "Vietcombank",
  "bank_code": "970436",
  "card_type": "DEBIT",
  "card_level": "STANDARD",
  "network": "NAPAS",
  "issuer_country": "VN",
  "bank_logo_url": "https://..."
}

Cache BIN lookups for performance

BIN data changes very rarely (only when a bank issues a new BIN). Cache it aggressively:

function lookup_bin_cached(bin_code):
    cache_key = "bin:{bin_code}"
 
    // Check cache
    cached = cache.get(cache_key)
    if cached exists:
        return parse_json(cached)
 
    // Gọi API
    result = lookup_bin_api(bin_code)
 
    // Cache 30 ngày — BIN data rất stable
    cache.set(cache_key, result, ttl = 30 days)
 
    return result

For high traffic, add an in-memory LRU cache:

// In-memory LRU cache: tối đa 10.000 entries, TTL 1 giờ
memory_cache = new LRUCache(max_size=10000, ttl=1 hour)
 
function lookup_bin_fast(bin_code):
    if bin_code in memory_cache:
        return memory_cache[bin_code]
 
    result = lookup_bin_cached(bin_code)
    memory_cache[bin_code] = result
    return result

Integrating with the checkout flow

The full pattern at checkout:

// Hook quản lý trạng thái BIN lookup tại checkout
function useCardLookup():
    state binInfo  = null
    state loading  = false
    debouncedLookup = debounce(lookupBin, delay=300ms)
 
    function onCardNumberChange(value):
        digits = strip_non_digits(value)
 
        if digits.length < 6:
            set binInfo = null
            return
 
        set loading = true
        info = debouncedLookup(first 9 digits of digits)
        set binInfo = info
        set loading = false
 
    return { binInfo, loading, onCardNumberChange }

Conclusion

BIN lookup is a small feature that makes a big difference in the payment experience: users see the bank logo the moment they enter a card, the system picks the right processor on its own, and fraud detection gains one more input signal. The cost to implement is low and the benefit is clear, so this is one of the first APIs worth integrating.

Topics
bin-lookuppayment-apicard-validationux

Start integrating today

Free sandbox · Full API docs · Technical support