How to parse credit card track data from magnetic swipe

Posted on 2012-09-19
Medium Priority
Last Modified: 2012-10-04
I recently took over a project involving "repairing" a vb6 project that is a Point of Sale System. I'd rather file my teeth than deal with vb6 but I'm given no choice. The client complains that they can not "swipe" credit cards and need to enter each field by hand when accepting credit cards...

Credit Card Number & Expiration Date

I know that credit card track data is in plain text and can easily be viewed by swiping into any text editor. But I am unable to see a commonality across different credit cards. i.e. Visa, Mastercard, Amex, Discover etc.

Is there a set way of parsing this information that I can get my hands on? Is there an ocx that does it already somewhere. I want to be able to capture the info from the swipe and automate the population of these fields to save the end user data entry time.

Any help would be appreciated.
Question by:edjucatable
LVL 58

Accepted Solution

Jim Dettman (Microsoft MVP/ EE MVE) earned 1500 total points
ID: 38417581
There are three tracks on a card.  The first two are the card data and can be in one of two formats.  Format "A" is up to the issuer of the card, "B" is standard and has the following:

Format code="B" -- 1 character (alpha only)
Primary account number -- up to 19 characters
Country code -- 3 characters
Name -- 2-26 characters
Expiration date or separator -- 4 characters or 1 character
Discretionary data -- enough characters to fill out maximum record length (79 characters total)
Longitudinal Redundancy Check (LRC) -- 1 character

 There's some seperators in there as well.  

 So is this a feature that was working in the software or something new they want added?  What country is this in and what reader are you using?


Author Closing Comment

ID: 38465033
Thanks Jim for the help. I'm new to experts exchange so after waiting a few days I ended up testing a ton of cards into note pad and deciphered enough to make the app work. It was something they originally wanted from the original developer and it never worked because his or her way or parsing only worked for certain cards. It's been over a week now and they haven't encountered anything that deviates from what we found.

Thank you again!

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question