This is not as simple as you might first imagine.
- Record Audio. You will have to continuously read audio and place it into a buffer.
- Decode Audio, save as 16bit PCM encoded, sampled at 44100hz. You will have to note when zero crossings occur and based on it generate a binary string. Then convert that binary string to ASCII.
- Once you are this far you have your track 1 or track 2 data! From here you can follow the ISO 7813 format if you are parsing credit cards. It fairly easy to parse, once you understand the spec.
Check out these resources. Good luck! AUDIO TO TRACK DATA: http://www.instructables.com/id/Read-any-magnetic-strip-card-with-a-Square-reader-/
TRACK DATA:
http://en.wikipedia.org/wiki/ISO/IEC_7813
http://www.gae.ucm.es/~padilla/extrawork/tracks.html