ISO/IEC 7813
ISO/IEC 7813 is an international standard codified by the International Standards Organization and International Electrotechnical Commission that defines properties of financial transaction cards,[1] e.g. ATM or credit cards.
The standard defines:
- physical characteristics, e.g. size, shape, location of magnetic stripe etc.
- magnetic track data structures
Contents |
Physical characteristics [edit]
ISO/IEC 7813 specifies the following physical characteristics of the card, mostly by reference to other standards:
- Embossed characters
- by reference to ISO/IEC 7811
- Embossing of expiration date
- the format, e.g. MM/YY or MM-YY
- Magnetic stripe
- by reference to ISO/IEC 7811
- Integrated circuit with contacts
- by reference to ISO/IEC 7816-1
- Integrated circuit without contacts
- by reference to ISO/IEC 10536-1, ISO/IEC 14443-1 or ISO/IEC 15693-1, as appropriate
Magnetic tracks [edit]
Track 1 [edit]
The Track 1 structure is specified as:
- STX : Start sentinel "%"
- FC : Format code "B" (The format described here. Format "A" is reserved for proprietary use.)
- PAN : Primary Account Number, up to 19 digits
- FS : Separator "^"
- NM : Name, 2 to 26 characters (including separators, where appropriate, between surname, first name etc.)
- FS : Separator "^"
- ED : Expiration data, 4 digits or "^"
- SC : Service code, 3 digits or "^"
- DD : Discretionary data, balance of characters
- ETX : End sentinel "?"
- LRC : Longitudinal redundancy check, calculated according to ISO/IEC 7811-2
The maximum record length is 79 alphanumeric characters.
Samples
%B6011898748579348^DOE/ JOHN ^37829821000123456789?
%B6011785948493759^DOE/JOHN L ^^^0000000 00998000000?
Track 2 [edit]
The Track 2 structure is specified as:
- STX : Start sentinel ";"
- PAN : Primary Account Number, up to 19 digits, as defined in ISO/IEC 7812-1
- FS : Separator "="
- ED : Expiration date, YYMM or "=" if not present
- SC : Service code, 3 digits or "=" if not present
- DD : Discretionary data, balance of available digits
- ETX : End sentinel "?"
- LRC : Longitudinal redundancy check, calculated according to ISO/IEC 7811-2
The maximum record length is 40 numeric digits.
Track 3 [edit]
Track 3 is virtually unused by the major worldwide networks, and often isn't even physically present on the card by virtue of a narrower magnetic stripe.
Programming [edit]
Parsing Track 1 and Track 2 can be done with Regular Expressions. Included here is just the Regular Expression for parsing Track 1.
Track 1
^%([A-Z])([0-9]{1,19})\^([^\^]{2,26})\^([0-9]{4}|\^)([0-9]{3}|\^)([^\?]+)\?$
This Regex will capture all of the important fields into the following groups:
- Group 1: Format Code
- Group 2: Primary account number (PAN)
- Group 3: Name
- Group 4: Expiration Date
- Group 5: Service Code
- Group 6: Discretionary data
References [edit]
| This standards- or measurement-related article is a stub. You can help Wikipedia by expanding it. |