Skip to content
This repository has been archived by the owner on Feb 16, 2018. It is now read-only.

Latest commit

 

History

History
34 lines (28 loc) · 1.27 KB

README.md

File metadata and controls

34 lines (28 loc) · 1.27 KB

Zebra

magnetic_stripe_prototype

An alternative to Stripe.js for card validation and token creation.

Heavily based off of stripe/jquery.payment.

This library uses CORS for the token creation.

Usage

Zebra.formatCardNumber("4242424242424242") //=> "4242 4242 4242 4242"
Zebra.cardType("4242 4242 4242 4242") //=> "visa"
Zebra.cardName("4242 4242 4242 4242") //=> "Visa"
Zebra.validateCardNumber("4242 4242 4242 4242") //=> true
Zebra.validateCardExpiry("12", "2050") //=> true
Zebra.validateCardExpiry("12", "50") //=> true
Zebra.validateCardExpiry("14", "2050") //=> false
Zebra.validateCardCVC("123") //=> true
Zebra.validateCardCVC("123", "amex") //=> true
Zebra.validateCardCVC("1234", "amex") //=> true
Zebra.validateCardCVC("12345") //=> false
Zebra.createToken({
	api_key: "YOUR_SECRET_KEY",
	number: "4242 4242 4242 4242",
	exp_month: "12",
	exp_year: "2050",
	cvc: "123",
	name: "Alex Smith" // name is optional
}, function (res, xhr) {});