Identifying cards
In some situations, there is a need to classify the card that is used according to the issuer, e.g. to have a breakdown of how many transactions are with Visa, how many with MasterCard, how many with American Express, etc. The receipt data for a transaction contains a card name, but this is not definitive and should not be used for the purposes of classifying payment cards.
The most reliable way to do this is to look at the card IIN (issuer identification number, formerly “BIN” or bank identification number), which is the first set of digits in the masked card number, or the application identifier or AID (see ApplicationId).
Note that the AID is specific to EMV technologies, i.e. chip and contactless transactions. Card swipe transactions will only provide the masked card number.
Card IIN lookup
There are some simple rules for card numbers. In general if it begins with a 4 it is a Visa card, and if it begins with a 5 it is a MasterCard. American Express cards begin with 3. The detail is not so simple, however, and other brands like JCB, UnionPay, Diners Club, etc., have more specific sub-ranges. A good starting point for this subject is https://en.wikipedia.org/wiki/Payment_card_number.
AID lookup
The Application Identifier is a sequence of hexadecimal letters and numbers. It is formed from two parts, the RID (Registered Application Provider Identifier) and the PIX (Proprietary Application Identifier Extension).
The RID is 10 characters long and is normally enough to identify the card issuer. Examples are:
- A000000003: Visa
- A000000004: MasterCard
- A000000025: American Express
- A000000333: UnionPay
A list of RIDs can be found at https://www.eftlab.com/knowledge-base/212-emv-rid. It is a long list, and clients should decide exactly how much detail is needed in the breakdown of issuers. For example, it may be enough to pick the top 5 issuers and then classify everything else as ‘Others’.