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
Your website's design is not only visually appealing but also reflects a modern and innovative approach. Well done!maklon kosmetik palembang
ReplyDeleteYour talents seem endless! It's incredible to see how effortlessly you excel in so many different areas markaszeus
ReplyDeleteThumbs up! This website is a pleasure to explore, with its captivating design markastoto
ReplyDeleteNikmati sensasi bermain tak terlupakan di Jokerslot Com, situs slot online pilihan para pecinta permainan taruhan daring.
ReplyDeleteJokerslot: Where every spin is a chance to win big! Immerse yourself in a world of excitement and rewards.
ReplyDeleteThis website is simply fantastic! The design is sleek and user-friendly, making navigation a breeze. X500 Slot
ReplyDeleteBravo! Navigating through the pages is seamless, and the content is both relevant and compelling. Hokiwin
ReplyDelete