aneeshvaidya / magnet

Magnetic Track Data parsing library

Home Page:http://shopify.github.io/magnet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Magnetic Track Data parsing library

http://shopify.github.io/magnet

License:MIT License


Languages

Language:Ruby 100.0%