Credit Card Number
finance.payment.credit_card_numberCredit card or debit card primary account number (PAN). Typically 13-19 digits. Last digit is check digit (Luhn algorithm). HIGHLY SENSITIVE — encrypt immediately in production.
Operations on this type: Hash or mask a column, Parse nested values, Check data quality
Try a value
Credit Card Number's rule accepts it.
Reads it as 4532015112830366
4×2=8 + 5 + 3×2=6 + 2 + 0×2=0 + 1 + 5×2=10→1 + 1 + 1×2=2 + 2 + 8×2=16→7 + 3 + 0×2=0 + 3 + 6×2=12→3
total = 44
(10 − 44 mod 10) mod 10 = 6
The check digit is 6, and the last digit is 6, which matches.
Algorithm: Luhn algorithm - Wikipedia
Use it
finetype infer -i '4532015112830366' --mode column
# → finance.payment.credit_card_numberSELECT ft_infer('4532015112830366');
-- → 'finance.payment.credit_card_number'CAST({col} AS VARCHAR)How finetype reads the samples
DuckDB 1.5.5 · finetype 0.6.66
| Value | As VARCHAR | card_type | issuer_identification_number | last_four |
|---|---|---|---|---|
| 4532015112830366 | 4532015112830366 | Visa | 453201 | 0366 |
| 5425233430109903 | 5425233430109903 | Mastercard | 542523 | 9903 |
| 374245455400126 | 374245455400126 | Amex | 374245 | 0126 |
Pattern
^[0-9]{13,19}$| Value | Length | Shape |
|---|---|---|
| 4532015112830366 | 16 | matches |
| 5425233430109903 | 16 | matches |
| 374245455400126 | 15 | matches |
Background
Origin
A payment card number, also called a primary account number (PAN), is the card identifier found on payment cards such as credit cards and debit cards.[1] Payment card numbers are allocated in accordance with ISO/IEC 7812.[1] ISO/IEC 7812, Identification cards – Identification of issuers, is an international standard published jointly by the International Organization for Standardization (ISO) and the International Electrotechnical Commission (IEC).[2] ISO/IEC 7812 has two parts: Part 1, Numbering system, and Part 2, Application and registration procedures.[2] The registration authority for issuer identification numbers is the American Bankers Association.[2]
The leading digits of a payment card number form the issuer identification number (IIN), sometimes called the bank identification number (BIN).[1] The first digit of the IIN is the major industry identifier (MII).[1] The digits after the IIN, except the last, are the individual account identification number.[1] The last digit of a payment card number is a check digit calculated with the Luhn algorithm.[1] The maximum total length of a PAN is 19 digits.[2]
The Luhn algorithm was created by IBM scientist Hans Peter Luhn.[3] The Luhn algorithm is described in US patent 2950048A, granted on 23 August 1960.[3] The Luhn algorithm is specified in Annex B of ISO/IEC 7812-1.[2] The Luhn algorithm was meant to let a computer quickly check a number for errors when a human enters it.[3] The Luhn algorithm was designed to protect against accidental errors, not malicious attacks.[3]
Use
Wikipedia's table of issuing networks lists the IIN range of Visa as 4.[1] Wikipedia's table of issuing networks lists the IIN ranges of American Express as 34 and 37.[1] American Express card numbers are 15 digits long.[1] Visa's VPay brand can specify PAN lengths from 13 to 19 digits.[1] Treat any brand lookup built from leading digits as a guide that needs refreshing as networks add ranges, not as a fixed fact. (Meridian's view)
Most credit card numbers use the Luhn algorithm as a simple way to tell valid numbers from mistyped or otherwise incorrect ones.[3] The Luhn algorithm detects all single-digit errors and almost all transpositions of adjacent digits.[3] The Luhn algorithm does not detect the transposition of 09 to 90, or the reverse.[3] A column dominated by a handful of repeated numbers may well be test data rather than real cards, so check where it came from before you treat it as either. (Meridian's view) Strip spaces and hyphens before you validate a card number, and keep it as text rather than as a number. (Meridian's view)
The PCI Security Standards Council says the first six and last four digits is the truncation format accepted by all payment brands.[4] Tokenisation replaces the true account number with an artificial account number, or token, that is printed, stored or transmitted in its place.[1] If you meet full card numbers in a file where you did not expect them, raise it with whoever owns data protection before you go any further. (Meridian's view)
Sources
- [1]Payment card number - Wikipediasecondary source
- [2]ISO/IEC 7812 - Wikipediasecondary source
- [3]Luhn algorithm - Wikipediasecondary source
- [4]8-digit BINs and PCI DSS: What You Need to Knoworganisation
How it's detected
Check digit uses Luhn algorithm (validated in crate, not SQL). MUST be encrypted/tokenized in production. PCI DSS compliance required. Decompose extracts issuer ID, card type, last 4.
Schema
https://meridian.online/schemas/finance.payment.credit_card_number · Frictionless type string
finetype taxonomy finance.payment.credit_card_number -o json-schema