简体   繁体   English

如何区分付款卡(例如信用卡/借记卡)号和非付款卡号?

[英]How to differentiate between Payment card (e.g. Credit/Debit cards) number and Non-Payment cards numbers?

I am working on a mobile payment app. 我正在开发移动支付应用程序。 User can add all his cards, both payment (eg Credit/Debit/Cash cards) and non-payment (loyalty cards to earn points) cards to the app. 用户可以将其所有卡(包括支付卡(例如信用卡/借记卡/现金卡)和非支付卡(用于赚取积分的会员卡))添加到应用中。

While adding card, I want to differentiate between these two types of cards and want to show them in separate lists within app. 在添加卡片时,我要区分这两种类型的卡片,并希望在应用程序的单独列表中显示它们。

I though Luhn algorithm will do but even non-payment cards happen to calculate check digit as per the Luhn algorithm. 尽管可以使用Luhn算法,但即使是非支付卡,也都可以按照Luhn算法计算支票号码。

Please suggest if there is any other mechanism which I can use to differentiate between these two types of cards pragmatically. 请提出我是否可以使用其他机制来实际区分这两种类型的卡。

thanks 谢谢

As @iso8583-info-support implied in their comment , the only good way to do this is a BIN range lookup. 正如@ iso8583-info-support在其评论中暗示的那样,执行此操作的唯一好方法是BIN范围查找。 A BIN is the first few digits of a card (technically, up to 6) which are issued in ranges to card issuers. BIN是卡的头几位数(从技术上讲,最多为6位),该位数在发卡机构的范围内发行。 So for example, Visa "owns" 4* , so any card that starts with a 4 is a Visa card. 例如,Visa“拥有” 4* ,因此任何以4开头的卡都是Visa卡。 MasterCard "owns" 2221*-2720* and 51*-55* , so any card which starts with a 51 , 52 , 53 , 54 , or 55 is a MasterCard, but a card which start with a 56 is not. 万事达“拥有” 2221*-2720*51*-55* ,因此,其与启动任何卡51525354 ,或55是万事达卡,但其与启动一个卡56是没有的。 (It's actually a Maestro card, which is a MasterCard sub-brand, but it's still technically separate - one's debit, the other is credit.) Anything unrecognized on a public BIN is almost certainly a loyalty card. (它实际上是Maestro卡,是MasterCard的子品牌,但在技术上仍是分开的-一个借记卡,另一个是贷记卡。)公用BIN上任何未被识别的东西几乎肯定是会员卡。

This can be a database table, but it doesn't have to be - you can easily hard code it into your app. 这可以是数据库表,但不一定非要这样-您可以轻松地将其硬编码到应用程序中。 But be sure to make it adjustable. 但是请确保使其可调。 MasterCard will start introducing card numbers which begin with a 2 in this coming October... if you can't modify your app to support that, you're going to annoy users. 万事达卡将在今年10月开始引入以2开头的卡号。如果您不能修改应用程序来支持它,则会惹恼用户。

This table on Wikipedia has all the major BIN ranges. Wikipedia上的此表具有所有主要的BIN范围。 There's also at least one company that sells an API which goes into far more detail and is kept much more up-to-date than Wikipedia. 还有至少一家出售API的公司 ,它提供了比Wikipedia更详细的信息并保持最新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM