Full width home advertisement

Post Page Advertisement [Top]

Visa Card, Credit Card, Master Card

Hello,
If you want to get card type i.e. Visa, Master, Rupay etc. by card number, here is the code you can use.

This code uses regex for filtering out card type. You can use this method for getting the card type from card number (without space separation).



public String getCardType(String mCardNumber) {
        if (mCardNumber.startsWith("4")) {
            return "VISA";
        }else if (mCardNumber.matches("^508[5-9][0-9][0-9]|60698[5-9]|60699[0-9]|607[0-8][0-9][0-9]|6079[0-7][0-9]|60798[0-4]|(?!608000)608[0-4][0-9][0-9]|608500|6521[5-9][0-9]|652[2-9][0-9][0-9]|6530[0-9][0-9]|6531[0-4][0-9]")){
            return "RUPAY";
        } else if (mCardNumber.matches("^((6304)|(6706)|(6771)|(6709))[\\d]+")) {
            return "LASER";
        } else if (mCardNumber.matches("6(?:011|5[0-9]{2})[0-9]{12}[\\d]+")) {
            return "LASER";
        } else if (mCardNumber.matches("(5[06-8]|6\\d)\\d{14}(\\d{2,3})?[\\d]+") || mCardNumber.matches("(5[06-8]|6\\d)[\\d]+") || mCardNumber.matches("((504([435|645|774|775|809|993]))|(60([0206]|[3845]))|(622[018])\\d)[\\d]+")) {
            
            return "MAESTRO";
        } else if (mCardNumber.matches("^5[1-5][\\d]+")) {
            return "MASTER";
        } else if (mCardNumber.matches("^3[47][\\d]+")) {
            return "AMEX";
        } else if (mCardNumber.startsWith("36") || mCardNumber.matches("^30[0-5][\\d]+") || mCardNumber.matches("2(014|149)[\\d]+")) {
            return "DINR";
        } else if (mCardNumber.matches("^35(2[89]|[3-8][0-9])[\\d]+")) {
            return "JCB";
        }
        return "";
    }



[PHP]How to get credit card/debit card type(i.e. Visa, Master) from card number

9 comments:

  1. Nikmati sensasi bermain tak terlupakan di Jokerslot Com, situs slot online pilihan para pecinta permainan taruhan daring.

    ReplyDelete
  2. Jokerslot: Where every spin is a chance to win big! Immerse yourself in a world of excitement and rewards.

    ReplyDelete
  3. This website has become an essential part of my daily routine. I've learned so much from reading the articles and engaging with the community here. It's like having a trusted mentor at my fingertips. Oke4d

    ReplyDelete
  4. Your blog has become my go-to resource whenever I need guidance or inspiration. I can't thank you enough for all that you do. Markastoto

    ReplyDelete
  5. Maximize your website's potential with customized Kimtoto solutions tailored to your goals. Kimtoto

    ReplyDelete
  6. Your website has helped me develop a greater sense of self-awareness and understanding of my own emotions and motivations. Kimtoto

    ReplyDelete
  7. I appreciate the attention to detail on your website. It's clear that every element has been carefully considered! Bostoto

    ReplyDelete
  8. The mobile responsiveness of your website is top-notch. It makes accessing your content on the go a breeze! Bostoto

    ReplyDelete
  9. The visuals on your website are top-notch.. Markaszeus

    ReplyDelete

Bottom Ad [Post Page]

| Designed by Colorlib