Swiper parses Track 1 data from a raw credit card swipe.
Ruby
Switch branches/tags
Nothing to show
Latest commit 4774258 May 3, 2013 @gmoore gmoore can_parse checks the regex for a proper regex. Not the fastest (becau…
…se the regex runs in .parse too) but it'll work for now
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
Gemfile.lock
README.md
Rakefile
swiper-0.0.2.gem
swiper.gemspec

README.md

Swiper

Swiper parses Track 1 data from a raw credit card swipe. Wikipedia Link

Install

Ruby

gem install swiper

Bundler

gem 'swiper'

Use

swiped_data = "%B0123456789012345^DURDEN/TYLER Q^1409101000000000000000000000000?;0123456789012345=15021010000000000869?"

if Swiper.can_parse? swiped_data
  card_data = Swiper.parse(swiped_data)
end

puts card_data.track1.raw
puts card_data.track1.track_format
puts card_data.track1.primary_account_number
puts card_data.track1.cardholder_name
puts card_data.track1.expiration_month
puts card_data.track1.expiration_year

Coming soon

  • Track2 parsing