Magnetic Track Data parsing library
Clone or download
abecevello Merge pull request #9 from Shopify/allow-start-sentinel-emv
Allow EMV track start sentinel in EMV format
Latest commit 9c7bc3b Sep 28, 2016

README.md

Build Status

magnet

magnet is a library for decoding the track data on magnetic stripe cards.

Description

magnet lets you parse track data from magnetic stripe cards. Currently supports tracks 1 & 2 from bank cards.

Installation

Add this line to your application's Gemfile:

gem "magnet"

And then execute:

$ bundle install

Or install it yourself as:

$ gem install magnet

Usage

require "magnet"

card = Magnet::Card.parse("%B5452300551227189^HOGAN/PAUL      ^08043210000000725000000?")
card.expiration_month # => 04
card.expiration_year # => 08
card.format # => :bank
card.first_name # => "PAUL"
card.last_name # => "HOGAN"
card.number # => 5452300551227189
card.no_service_restrictions? # => true
card.process_by_issuer? # => true

Contributing

Fork, branch & pull request.

Sources