API DOCUMENTATION

BIIN LOOKUP API
MobiBiin by MobiCard

Use this API to retrieve detailed card issuer information using the Bank Identification Number (BIN/IIN). Identify card schemes, issuer banks, card types, and geographical information for risk management, fraud prevention, and payment processing optimization.

Get instant access to comprehensive card metadata including issuer bank details, card scheme, card type, country information, and prepaid status. Perfect for fraud screening, payment routing decisions, and customer experience enhancement.

Risk Management Benefit: Identify high-risk card types (prepaid, virtual), detect cross-border transactions, and implement geolocation-based fraud prevention rules. You may also use card_biin_information.card_biin_risk_flag field to assist in making fraud control or risk monitoring decisions.
Comprehensive Data: Returns 15+ data points including card scheme (Visa/Mastercard), issuer bank details, card type, country information, and prepaid status.

API Endpoint: Single request for comprehensive BIN data

BIIN Lookup API Overview

Retrieve comprehensive card issuer information using the first 6-8 digits (BIN/IIN) of a payment card. The API returns detailed metadata about the card issuer, card type, and geographical information.

Use Case: During payment processing, validate card details, identify issuer bank, detect prepaid cards, implement country-specific rules, and enhance fraud screening.
Flexible Input: Accepts 6-digit BIN, 8-digit BIIN, or full card number. The system automatically extracts the relevant prefix for lookup.

BIIN Lookup Implementation

Generate a signed JWT token with embedded request.

Send card BIN/BIIN (first 6-8 digits) or full card number to receive comprehensive issuer information.

PHP Implementation
<?php

// Mandatory claims
$mobicard_version = "2.0";
$mobicard_mode = "LIVE"; // production
$mobicard_merchant_id = "4";
$mobicard_api_key = "YmJkOGY0OTZhMTU2ZjVjYTIyYzFhZGQyOWRiMmZjMmE2ZWU3NGIxZWM3ZTBiZSJ9";
$mobicard_secret_key = "NjIwYzEyMDRjNjNjMTdkZTZkMjZhOWNiYjIxNzI2NDQwYzVmNWNiMzRhMzBjYSJ9";

$mobicard_token_id = abs(rand(1000000,1000000000));
$mobicard_token_id = "$mobicard_token_id";

$mobicard_txn_reference = abs(rand(1000000,1000000000)); // Your reference
$mobicard_txn_reference = "$mobicard_txn_reference";

$mobicard_service_id = "20000"; // Card Services ID
$mobicard_service_type = "BIINLOOKUP";

// Accepts 6-digit BIN, 8-digit BIIN, or full card number
$mobicard_card_number = "5173350006475601";
$mobicard_card_biin = substr($mobicard_card_number, 0, 8); // Extract first 8 digits

// Create JWT Header
$mobicard_jwt_header = [
    "typ" => "JWT",
    "alg" => "HS256"
];
$mobicard_jwt_header = rtrim(strtr(base64_encode(json_encode($mobicard_jwt_header)), '+/', '-_'), '=');

// Create JWT Payload
$mobicard_jwt_payload = array(
    "mobicard_version" => "$mobicard_version",
    "mobicard_mode" => "$mobicard_mode",
    "mobicard_merchant_id" => "$mobicard_merchant_id",
    "mobicard_api_key" => "$mobicard_api_key",
    "mobicard_service_id" => "$mobicard_service_id",
    "mobicard_service_type" => "$mobicard_service_type",
    "mobicard_token_id" => "$mobicard_token_id",
    "mobicard_txn_reference" => "$mobicard_txn_reference",
    "mobicard_card_biin" => "$mobicard_card_biin"
);

$mobicard_jwt_payload = rtrim(strtr(base64_encode(json_encode($mobicard_jwt_payload)), '+/', '-_'), '=');

// Generate Signature
$header_payload = $mobicard_jwt_header . '.' . $mobicard_jwt_payload;
$mobicard_jwt_signature = rtrim(strtr(base64_encode(hash_hmac('sha256', $header_payload, $mobicard_secret_key, true)), '+/', '-_'), '=');

// Create Final JWT
$mobicard_auth_jwt = "$mobicard_jwt_header.$mobicard_jwt_payload.$mobicard_jwt_signature";

// Make API Call
$mobicard_request_access_token_url = "https://mobicardsystems.com/api/v1/biin_lookup";

$mobicard_curl_post_data = array('mobicard_auth_jwt' => $mobicard_auth_jwt);

$curl_mobicard = curl_init();
curl_setopt($curl_mobicard, CURLOPT_URL, $mobicard_request_access_token_url);
curl_setopt($curl_mobicard, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_mobicard, CURLOPT_POST, true);
curl_setopt($curl_mobicard, CURLOPT_POSTFIELDS, json_encode($mobicard_curl_post_data));
curl_setopt($curl_mobicard, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl_mobicard, CURLOPT_SSL_VERIFYPEER, false);
$mobicard_curl_response = curl_exec($curl_mobicard);
curl_close($curl_mobicard);

// Parse Response
$response_data = json_decode($mobicard_curl_response, true);

if(isset($response_data) && is_array($response_data)) {
    
    if($response_data['status'] === 'SUCCESS') {
        
        // Access card issuer information
        $card_scheme = $response_data['card_biin_information']['card_biin_scheme'];
        $issuer_bank = $response_data['card_biin_information']['card_biin_bank_name'];
        $card_type = $response_data['card_biin_information']['card_biin_type'];
        $country = $response_data['card_biin_information']['card_biin_country_name'];
        $is_prepaid = $response_data['card_biin_information']['card_biin_prepaid'];
        
        echo "BIIN Lookup Successful!
"; echo "Card Scheme: " . $card_scheme . "
"; echo "Issuer Bank: " . $issuer_bank . "
"; echo "Card Type: " . $card_type . "
"; echo "Country: " . $country . "
"; echo "Prepaid: " . $is_prepaid . "
"; // Use this information for risk assessment and payment processing if($is_prepaid === 'Yes') { echo "Note: Prepaid card detected - apply appropriate risk rules."; } } else { echo "Error: " . $response_data['status_message'] . " (Code: " . $response_data['status_code'] . ")"; } } else { echo "Error: Invalid API response"; }
cURL Implementation
#!/bin/bash

# Configuration
MOBICARD_VERSION="2.0"
MOBICARD_MODE="LIVE"
MOBICARD_MERCHANT_ID="4"
MOBICARD_API_KEY="YmJkOGY0OTZhMTU2ZjVjYTIyYzFhZGQyOWRiMmZjMmE2ZWU3NGIxZWM3ZTBiZSJ9"
MOBICARD_SECRET_KEY="NjIwYzEyMDRjNjNjMTdkZTZkMjZhOWNiYjIxNzI2NDQwYzVmNWNiMzRhMzBjYSJ9"
MOBICARD_TOKEN_ID=$(shuf -i 1000000-1000000000 -n 1)
MOBICARD_TXN_REFERENCE=$(shuf -i 1000000-1000000000 -n 1)
MOBICARD_SERVICE_ID="20000"
MOBICARD_SERVICE_TYPE="BIINLOOKUP"

# Accepts 6-digit BIN, 8-digit BIIN, or full card number
MOBICARD_CARD_NUMBER="5173350006475601"
MOBICARD_CARD_BIIN=${MOBICARD_CARD_NUMBER:0:8} # Extract first 8 digits

# Create JWT Header
JWT_HEADER=$(echo -n '{"typ":"JWT","alg":"HS256"}' | base64 | tr '+/' '-_' | tr -d '=')

# Create JWT Payload
PAYLOAD_JSON=$(cat << EOF
{
  "mobicard_version": "$MOBICARD_VERSION",
  "mobicard_mode": "$MOBICARD_MODE",
  "mobicard_merchant_id": "$MOBICARD_MERCHANT_ID",
  "mobicard_api_key": "$MOBICARD_API_KEY",
  "mobicard_service_id": "$MOBICARD_SERVICE_ID",
  "mobicard_service_type": "$MOBICARD_SERVICE_TYPE",
  "mobicard_token_id": "$MOBICARD_TOKEN_ID",
  "mobicard_txn_reference": "$MOBICARD_TXN_REFERENCE",
  "mobicard_card_biin": "$MOBICARD_CARD_BIIN"
}
EOF
)

JWT_PAYLOAD=$(echo -n "$PAYLOAD_JSON" | base64 | tr '+/' '-_' | tr -d '=')

# Generate Signature
HEADER_PAYLOAD="$JWT_HEADER.$JWT_PAYLOAD"
JWT_SIGNATURE=$(echo -n "$HEADER_PAYLOAD" | openssl dgst -sha256 -hmac "$MOBICARD_SECRET_KEY" -binary | base64 | tr '+/' '-_' | tr -d '=')

# Create Final JWT
MOBICARD_AUTH_JWT="$JWT_HEADER.$JWT_PAYLOAD.$JWT_SIGNATURE"

# Make API Call
API_URL="https://mobicardsystems.com/api/v1/biin_lookup"

RESPONSE=$(curl -X POST "$API_URL" \
  -H "Content-Type: application/json" \
  -d "{\"mobicard_auth_jwt\":\"$MOBICARD_AUTH_JWT\"}" \
  --silent)

echo "$RESPONSE" | python -m json.tool
Python Implementation
import json
import base64
import hmac
import hashlib
import random
import requests

class MobicardBiinLookup:
    def __init__(self, merchant_id, api_key, secret_key):
        self.mobicard_version = "2.0"
        self.mobicard_mode = "LIVE"
        self.mobicard_merchant_id = merchant_id
        self.mobicard_api_key = api_key
        self.mobicard_secret_key = secret_key
        self.mobicard_service_id = "20000"
        self.mobicard_service_type = "BIINLOOKUP"
        
        self.mobicard_token_id = str(random.randint(1000000, 1000000000))
        self.mobicard_txn_reference = str(random.randint(1000000, 1000000000))
    
    def lookup_biin(self, card_input):
        """Lookup card issuer information using BIN/BIIN"""
        
        # Accepts 6-digit BIN, 8-digit BIIN, or full card number
        if len(card_input) >= 8:
            mobicard_card_biin = card_input[:8]
        elif len(card_input) >= 6:
            mobicard_card_biin = card_input[:6]
        else:
            return {'status': 'ERROR', 'error_message': 'Invalid card input - must be at least 6 digits'}
        
        # Create JWT Header
        jwt_header = {"typ": "JWT", "alg": "HS256"}
        encoded_header = base64.urlsafe_b64encode(
            json.dumps(jwt_header).encode()
        ).decode().rstrip('=')
        
        # Create JWT Payload
        jwt_payload = {
            "mobicard_version": self.mobicard_version,
            "mobicard_mode": self.mobicard_mode,
            "mobicard_merchant_id": self.mobicard_merchant_id,
            "mobicard_api_key": self.mobicard_api_key,
            "mobicard_service_id": self.mobicard_service_id,
            "mobicard_service_type": self.mobicard_service_type,
            "mobicard_token_id": self.mobicard_token_id,
            "mobicard_txn_reference": self.mobicard_txn_reference,
            "mobicard_card_biin": mobicard_card_biin
        }
        
        encoded_payload = base64.urlsafe_b64encode(
            json.dumps(jwt_payload).encode()
        ).decode().rstrip('=')
        
        # Generate Signature
        header_payload = f"{encoded_header}.{encoded_payload}"
        signature = hmac.new(
            self.mobicard_secret_key.encode(),
            header_payload.encode(),
            hashlib.sha256
        ).digest()
        encoded_signature = base64.urlsafe_b64encode(signature).decode().rstrip('=')
        
        jwt_token = f"{encoded_header}.{encoded_payload}.{encoded_signature}"
        
        # Make API Call
        url = "https://mobicardsystems.com/api/v1/biin_lookup"
        payload = {"mobicard_auth_jwt": jwt_token}
        
        try:
            response = requests.post(url, json=payload, verify=False, timeout=30)
            response_data = response.json()
            
            if response_data.get('status') == 'SUCCESS':
                return {
                    'status': 'SUCCESS',
                    'card_scheme': response_data['card_biin_information']['card_biin_scheme'],
                    'issuer_bank': response_data['card_biin_information']['card_biin_bank_name'],
                    'card_type': response_data['card_biin_information']['card_biin_type'],
                    'country': response_data['card_biin_information']['card_biin_country_name'],
                    'is_prepaid': response_data['card_biin_information']['card_biin_prepaid'],
                    'raw_response': response_data
                }
            else:
                return {
                    'status': 'ERROR',
                    'status_code': response_data.get('status_code'),
                    'status_message': response_data.get('status_message')
                }
                
        except Exception as e:
            return {'status': 'ERROR', 'error_message': str(e)}

# Usage
biin_lookup = MobicardBiinLookup(
    merchant_id="4",
    api_key="YmJkOGY0OTZhMTU2ZjVjYTIyYzFhZGQyOWRiMmZjMmE2ZWU3NGIxZWM3ZTBiZSJ9",
    secret_key="NjIwYzEyMDRjNjNjMTdkZTZkMjZhOWNiYjIxNzI2NDQwYzVmNWNiMzRhMzBjYSJ9"
)

# Can use 6-digit BIN, 8-digit BIIN, or full card number
result = biin_lookup.lookup_biin("5173350006475601")  # Full card number
# result = biin_lookup.lookup_biin("51733500")  # 8-digit BIIN
# result = biin_lookup.lookup_biin("517335")    # 6-digit BIN

if result['status'] == 'SUCCESS':
    print(f"Card Scheme: {result['card_scheme']}")
    print(f"Issuer Bank: {result['issuer_bank']}")
    print(f"Card Type: {result['card_type']}")
    print(f"Country: {result['country']}")
    print(f"Prepaid: {result['is_prepaid']}")
    
    if result['is_prepaid'] == 'Yes':
        print("Note: Prepaid card detected - apply appropriate risk rules.")
else:
    print(f"Error: {result.get('status_message')}")
Node JS Implementation
const crypto = require('crypto');
const axios = require('axios');

class MobicardBiinLookup {
    constructor(merchantId, apiKey, secretKey) {
        this.mobicardVersion = "2.0";
        this.mobicardMode = "LIVE";
        this.mobicardMerchantId = merchantId;
        this.mobicardApiKey = apiKey;
        this.mobicardSecretKey = secretKey;
        this.mobicardServiceId = "20000";
        this.mobicardServiceType = "BIINLOOKUP";
        
        this.mobicardTokenId = Math.floor(Math.random() * (1000000000 - 1000000 + 1)) + 1000000;
        this.mobicardTxnReference = Math.floor(Math.random() * (1000000000 - 1000000 + 1)) + 1000000;
    }

    generateJWT(cardInput) {
        // Accepts 6-digit BIN, 8-digit BIIN, or full card number
        let mobicardCardBiin;
        if (cardInput.length >= 8) {
            mobicardCardBiin = cardInput.substring(0, 8);
        } else if (cardInput.length >= 6) {
            mobicardCardBiin = cardInput.substring(0, 6);
        } else {
            throw new Error('Invalid card input - must be at least 6 digits');
        }

        const jwtHeader = { typ: "JWT", alg: "HS256" };
        const encodedHeader = Buffer.from(JSON.stringify(jwtHeader)).toString('base64url');

        const jwtPayload = {
            mobicard_version: this.mobicardVersion,
            mobicard_mode: this.mobicardMode,
            mobicard_merchant_id: this.mobicardMerchantId,
            mobicard_api_key: this.mobicardApiKey,
            mobicard_service_id: this.mobicardServiceId,
            mobicard_service_type: this.mobicardServiceType,
            mobicard_token_id: this.mobicardTokenId.toString(),
            mobicard_txn_reference: this.mobicardTxnReference.toString(),
            mobicard_card_biin: mobicardCardBiin
        };

        const encodedPayload = Buffer.from(JSON.stringify(jwtPayload)).toString('base64url');

        const headerPayload = `${encodedHeader}.${encodedPayload}`;
        const signature = crypto.createHmac('sha256', this.mobicardSecretKey)
            .update(headerPayload)
            .digest('base64url');

        return `${encodedHeader}.${encodedPayload}.${signature}`;
    }

    async lookupBiin(cardInput) {
        try {
            const jwtToken = this.generateJWT(cardInput);
            
            const url = "https://mobicardsystems.com/api/v1/biin_lookup";
            const payload = { mobicard_auth_jwt: jwtToken };

            const response = await axios.post(url, payload, {
                httpsAgent: new (require('https').Agent)({ rejectUnauthorized: false })
            });

            const responseData = response.data;

            if (responseData.status === 'SUCCESS') {
                return {
                    status: 'SUCCESS',
                    cardScheme: responseData.card_biin_information.card_biin_scheme,
                    issuerBank: responseData.card_biin_information.card_biin_bank_name,
                    cardType: responseData.card_biin_information.card_biin_type,
                    country: responseData.card_biin_information.card_biin_country_name,
                    isPrepaid: responseData.card_biin_information.card_biin_prepaid,
                    rawResponse: responseData
                };
            } else {
                return {
                    status: 'ERROR',
                    statusCode: responseData.status_code,
                    statusMessage: responseData.status_message
                };
            }
        } catch (error) {
            return {
                status: 'ERROR',
                errorMessage: error.message
            };
        }
    }
}

// Usage
async function main() {
    const biinLookup = new MobicardBiinLookup(
        "4",
        "YmJkOGY0OTZhMTU2ZjVjYTIyYzFhZGQyOWRiMmZjMmE2ZWU3NGIxZWM3ZTBiZSJ9",
        "NjIwYzEyMDRjNjNjMTdkZTZkMjZhOWNiYjIxNzI2NDQwYzVmNWNiMzRhMzBjYSJ9"
    );

    // Can use 6-digit BIN, 8-digit BIIN, or full card number
    const result = await biinLookup.lookupBiin("5173350006475601"); // Full card number
    // const result = await biinLookup.lookupBiin("51733500"); // 8-digit BIIN
    // const result = await biinLookup.lookupBiin("517335");   // 6-digit BIN

    if (result.status === 'SUCCESS') {
        console.log("BIIN Lookup Successful!");
        console.log(`Card Scheme: ${result.cardScheme}`);
        console.log(`Issuer Bank: ${result.issuerBank}`);
        console.log(`Card Type: ${result.cardType}`);
        console.log(`Country: ${result.country}`);
        console.log(`Prepaid: ${result.isPrepaid}`);
        
        if (result.isPrepaid === 'Yes') {
            console.log("Note: Prepaid card detected - apply appropriate risk rules.");
        }
    } else {
        console.log(`Error: ${result.statusMessage}`);
    }
}

main();
Java Implementation
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.Base64;
import java.util.Random;
import java.util.HashMap;
import java.util.Map;

import com.google.gson.Gson;
import com.google.gson.JsonObject;

public class MobicardBiinLookup {
    
    private final String mobicardVersion = "2.0";
    private final String mobicardMode = "LIVE";
    private final String mobicardMerchantId;
    private final String mobicardApiKey;
    private final String mobicardSecretKey;
    private final String mobicardServiceId = "20000";
    private final String mobicardServiceType = "BIINLOOKUP";
    
    private final String mobicardTokenId;
    private final String mobicardTxnReference;
    
    private final Gson gson = new Gson();
    
    public MobicardBiinLookup(String merchantId, String apiKey, String secretKey) {
        this.mobicardMerchantId = merchantId;
        this.mobicardApiKey = apiKey;
        this.mobicardSecretKey = secretKey;
        
        Random random = new Random();
        this.mobicardTokenId = String.valueOf(random.nextInt(900000000) + 1000000);
        this.mobicardTxnReference = String.valueOf(random.nextInt(900000000) + 1000000);
    }
    
    public String generateJWT(String cardInput) throws Exception {
        // Accepts 6-digit BIN, 8-digit BIIN, or full card number
        String mobicardCardBiin;
        if (cardInput.length() >= 8) {
            mobicardCardBiin = cardInput.substring(0, 8);
        } else if (cardInput.length() >= 6) {
            mobicardCardBiin = cardInput.substring(0, 6);
        } else {
            throw new Exception("Invalid card input - must be at least 6 digits");
        }
        
        Map jwtHeader = new HashMap<>();
        jwtHeader.put("typ", "JWT");
        jwtHeader.put("alg", "HS256");
        String encodedHeader = base64UrlEncode(gson.toJson(jwtHeader));
        
        Map jwtPayload = new HashMap<>();
        jwtPayload.put("mobicard_version", mobicardVersion);
        jwtPayload.put("mobicard_mode", mobicardMode);
        jwtPayload.put("mobicard_merchant_id", mobicardMerchantId);
        jwtPayload.put("mobicard_api_key", mobicardApiKey);
        jwtPayload.put("mobicard_service_id", mobicardServiceId);
        jwtPayload.put("mobicard_service_type", mobicardServiceType);
        jwtPayload.put("mobicard_token_id", mobicardTokenId);
        jwtPayload.put("mobicard_txn_reference", mobicardTxnReference);
        jwtPayload.put("mobicard_card_biin", mobicardCardBiin);
        
        String encodedPayload = base64UrlEncode(gson.toJson(jwtPayload));
        
        String headerPayload = encodedHeader + "." + encodedPayload;
        String signature = generateHMAC(headerPayload, mobicardSecretKey);
        
        return encodedHeader + "." + encodedPayload + "." + signature;
    }
    
    public JsonObject lookupBiin(String cardInput) throws Exception {
        String jwtToken = generateJWT(cardInput);
        
        HttpClient client = HttpClient.newHttpClient();
        
        Map requestBody = new HashMap<>();
        requestBody.put("mobicard_auth_jwt", jwtToken);
        
        String jsonBody = gson.toJson(requestBody);
        
        HttpRequest request = HttpRequest.newBuilder()
                .uri(URI.create("https://mobicardsystems.com/api/v1/biin_lookup"))
                .header("Content-Type", "application/json")
                .POST(HttpRequest.BodyPublishers.ofString(jsonBody))
                .build();
        
        HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
        
        return gson.fromJson(response.body(), JsonObject.class);
    }
    
    private String base64UrlEncode(String data) {
        return Base64.getUrlEncoder().withoutPadding().encodeToString(data.getBytes());
    }
    
    private String generateHMAC(String data, String key) throws Exception {
        Mac sha256Hmac = Mac.getInstance("HmacSHA256");
        SecretKeySpec secretKey = new SecretKeySpec(key.getBytes(), "HmacSHA256");
        sha256Hmac.init(secretKey);
        byte[] hmacBytes = sha256Hmac.doFinal(data.getBytes());
        return base64UrlEncode(new String(hmacBytes));
    }
    
    public static void main(String[] args) {
        try {
            MobicardBiinLookup biinLookup = new MobicardBiinLookup(
                "4",
                "YmJkOGY0OTZhMTU2ZjVjYTIyYzFhZGQyOWRiMmZjMmE2ZWU3NGIxZWM3ZTBiZSJ9",
                "NjIwYzEyMDRjNjNjMTdkZTZkMjZhOWNiYjIxNzI2NDQwYzVmNWNiMzRhMzBjYSJ9"
            );
            
            // Can use 6-digit BIN, 8-digit BIIN, or full card number
            String cardInput = "5173350006475601"; // Full card number
            // String cardInput = "51733500"; // 8-digit BIIN
            // String cardInput = "517335";   // 6-digit BIN
            
            JsonObject result = biinLookup.lookupBiin(cardInput);
            
            if (result.has("status")) {
                String status = result.get("status").getAsString();
                
                if ("SUCCESS".equals(status)) {
                    System.out.println("BIIN Lookup Successful!");
                    
                    if (result.has("card_biin_information")) {
                        JsonObject biinInfo = result.getAsJsonObject("card_biin_information");
                        
                        System.out.println("Card Scheme: " + 
                            biinInfo.get("card_biin_scheme").getAsString());
                        System.out.println("Issuer Bank: " + 
                            biinInfo.get("card_biin_bank_name").getAsString());
                        System.out.println("Card Type: " + 
                            biinInfo.get("card_biin_type").getAsString());
                        System.out.println("Country: " + 
                            biinInfo.get("card_biin_country_name").getAsString());
                        System.out.println("Prepaid: " + 
                            biinInfo.get("card_biin_prepaid").getAsString());
                        
                        if ("Yes".equals(biinInfo.get("card_biin_prepaid").getAsString())) {
                            System.out.println("Note: Prepaid card detected - apply appropriate risk rules.");
                        }
                    }
                } else {
                    System.out.println("BIIN Lookup Failed!");
                    if (result.has("status_message")) {
                        System.out.println("Error: " + result.get("status_message").getAsString());
                    }
                }
            }
            
        } catch (Exception e) {
            System.err.println("Error: " + e.getMessage());
            e.printStackTrace();
        }
    }
}

Success Response Format

The BIIN Lookup API returns comprehensive card issuer information upon successful lookup.

JSON Success Response
{
  "status": "SUCCESS",
  "status_code": "200",
  "status_message": "SUCCESS",
  "mobicard_card_biin": "5173350006475601",
  "mobicard_txn_reference": "287972875",
  "mobicard_token_id": "325026456",
  "timestamp": "2026-01-27 14:21:52",
  "card_biin_information": {
    "card_biin_flag": 1,
    "card_biin_number": "51733500",
    "card_biin_scheme": "MASTERCARD",
    "card_biin_prefix": "",
    "card_biin_type": "PREPAID",
    "card_biin_brand": "Mastercard Prepaid General Spend",
    "card_biin_prepaid": "Yes",
    "card_biin_bank_name": "KCB BANK KENYA LIMITED",
    "card_biin_bank_url": "",
    "card_biin_bank_city": "",
    "card_biin_bank_phone": "",
    "card_biin_bank_logo": "",
    "card_biin_country_two_letter_code": "",
    "card_biin_country_name": "KENYA",
    "card_biin_country_numeric": "404",
    "card_biin_risk_flag": 0
  }
}
Response Fields Explanation:
  • status: Always "SUCCESS" or "FAILED" - use this to determine subsequent actions
  • status_code: HTTP status code (200 for success)
  • card_biin_information.card_biin_scheme: Card network (VISA, MASTERCARD, etc.)
  • card_biin_information.card_biin_bank_name: Issuing bank name
  • card_biin_information.card_biin_type: Card type (PREPAID, DEBIT, CREDIT)
  • card_biin_information.card_biin_prepaid: "Yes" if prepaid card, otherwise empty
  • card_biin_information.card_biin_country_name: Issuing country
  • card_biin_information.card_biin_flag: 1 if BIN found, 0 if not found
  • card_biin_information.card_biin_risk_flag: 1 if BIN is flagged as high risk, 0 if not

Error Response Format

Error responses have a simplified format with only 3 fields of essential information.

Use the "status" field to determine if any API request is successful or not. The value is always either "SUCCESS" or "FAILED".

JSON Error Response
{
  "status": "FAILED",
  "status_code": "400",
  "status_message": "BAD REQUEST"
}

Status Codes Reference

Complete list of status codes returned by the API.

Status Code Status Status Message Interpretation Action Required
200 SUCCESS SUCCESS Process the response data
400 FAILED BAD REQUEST - Invalid parameters or malformed request Check request parameters
429 FAILED TOO MANY REQUESTS - Rate limit exceeded Wait before making more requests
250 FAILED INSUFFICIENT TOKENS - Token account balance insufficient Top up your account
500 FAILED UNAVAILABLE - Server error Try again later or contact support
430 FAILED TIMEOUT - Request timed out Issue new token and retry

API Request Parameters Reference

Complete reference of all request parameters used in the BIIN Lookup API.

Parameter Required Description Example Value Notes
mobicard_version Yes API version "2.0" Fixed value
mobicard_mode Yes Environment mode "TEST" or "LIVE" Use TEST for development
mobicard_merchant_id Yes Your merchant ID "" Provided by MobiCard
mobicard_api_key Yes Your API key "" Provided by MobiCard
mobicard_secret_key Yes Your secret key "" Provided by MobiCard
mobicard_service_id Yes Service ID "20000" Fixed value for card services
mobicard_service_type Yes Service type "BIINLOOKUP" Fixed value
mobicard_token_id Yes Unique token identifier String/number Must be unique per request
mobicard_txn_reference Yes Your transaction reference String/number Your internal reference
mobicard_card_biin Yes Card BIN/BIIN or card number "51733500" or "5173350006475601" 6-8 digits or full card number

API Response Parameters Reference

Complete reference of all response parameters returned by the API.

The value for the "status" response parameter is always either "SUCCESS" or "FAILED". Use this to determine subsequent actions.

Parameter Always Returned Description Example Value
status Yes Transaction status "SUCCESS" or "FAILED"
status_code Yes HTTP status code "200"
status_message Yes Status description "SUCCESS"
mobicard_card_biin Yes Original BIN/BIIN/card number from request "5173350006475601"
mobicard_txn_reference Yes Your original transaction reference "287972875"
mobicard_token_id Yes Your unique API request id "325026456"
timestamp Yes Response timestamp "2026-01-27 14:21:52"
card_biin_information.card_biin_flag Yes 1 if BIN found, 0 if not found 1
card_biin_information.card_biin_number Yes 8-digit BIIN used for lookup "51733500"
card_biin_information.card_biin_scheme Yes Card network scheme "MASTERCARD"
card_biin_information.card_biin_prefix Yes Card prefix (if available) ""
card_biin_information.card_biin_type Yes Card type "PREPAID"
card_biin_information.card_biin_brand Yes Card brand description "Mastercard Prepaid General Spend"
card_biin_information.card_biin_prepaid Yes Prepaid status indicator "Yes"
card_biin_information.card_biin_bank_name Yes Issuing bank name "KCB BANK KENYA LIMITED"
card_biin_information.card_biin_bank_url Yes Bank website (if available) ""
card_biin_information.card_biin_bank_city Yes Bank city (if available) ""
card_biin_information.card_biin_bank_phone Yes Bank phone (if available) ""
card_biin_information.card_biin_bank_logo Yes Bank logo URL (if available) ""
card_biin_information.card_biin_country_two_letter_code Yes Country ISO code (if available) ""
card_biin_information.card_biin_country_name Yes Issuing country name "KENYA"
card_biin_information.card_biin_country_numeric Yes Country numeric code "404"
card_biin_information.card_biin_risk_flag Yes Fraud Control (Chargebacks). Turns on for high risk BIINs. 0

Best Practices & Use Cases

BIIN Lookup Workflow:
  • Step 1: Collect card details from customer (first 6-8 digits or full card number)
  • Step 2: Call BIIN Lookup API with card BIN/BIIN
  • Step 3: Analyze returned issuer information for risk assessment
  • Step 4: Implement business rules based on card type, country, and issuer
  • Step 5: Enhance fraud prevention with issuer-specific rules
  • Step 6: Improve customer experience with appropriate messaging
Security Considerations:
  • Store your 'api_key' and 'secret_key' in your .env file and never expose publicly
  • Implement proper PCI DSS compliance for card data handling
  • Use HTTPS for all API calls
  • Validate all responses on server-side
  • Implement rate limiting on your end
  • Log all BIN lookup attempts for audit and analytics
  • Cache frequent BIN lookups to reduce API calls
Risk Management Benefits:
  • Fraud Prevention: Identify high-risk card types (prepaid, virtual cards). You may also use card_biin_information.card_biin_risk_flag field to assist in making fraud control or risk monitoring decisions.
  • Geolocation: Detect cross-border transactions and apply country-specific rules
  • Issuer Validation: Verify card issuer matches customer location
  • Card Type Rules: Apply different rules for credit, debit, and prepaid cards
  • Chargeback Reduction: Identify risky issuers before processing transactions
  • Compliance: Ensure compliance with regional regulations based on issuer country
Implementation Tips:
  • Implement retry logic with exponential backoff for failed API calls
  • Cache BIN lookup results for 24-48 hours to reduce API calls
  • Monitor API usage and set up alerts for unusual patterns
  • Create a local BIN database cache for common issuers
  • Use the card_biin_flag field to handle unknown BIINs gracefully
  • Use the card_biin_risk_flag field to assist in making fraud control or risk monitoring decisions.

Frequently Asked Questions

Q: What is the difference between BIN and BIIN?

A: BIN (Bank Identification Number) is typically 6 digits, while BIIN (Bank Issuer Identification Number) is 8 digits. Our API accepts both 6-digit BINs and 8-digit BIINs, as well as full card numbers.

Q: How accurate is the issuer information?

A: Our database is regularly updated with information from card networks and issuing banks. Accuracy rates exceed 99% for active card ranges.

Q: Can I lookup virtual/prepaid cards?

A: Yes, the API identifies card types including PREPAID, DEBIT, CREDIT, and VIRTUAL cards. The card_biin_prepaid field indicates prepaid card status.

Q: What happens if the BIN is not found?

A: The card_biin_flag field will be set to 0, and other fields may be empty. Implement appropriate handling for unknown BINs in your application.

Q: How can I monitor risk using this API?

A: The card_biin_risk_flag field is by default set to 0. Use this field to assist in making fraud control or risk monitoring decisions.

Q: Is there a rate limit?

A: Yes, rate limits apply. If you exceed limits, you'll receive status code 429. Contact support for higher rate limits if needed.

Q: Can I use this for card validation?

A: While BIN lookup helps identify issuer information, it does not validate if a card is active or has funds. Use with other validation methods for complete card verification.