Created
April 30, 2016 04:27
-
-
Save rcdexta/e4f24fa2b3d42b4907a423a5ea3b1824 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
var expMonthAndYear = $('input[name=expiry]').val().split(" / "); | |
Stripe.card.createToken({ | |
number: $('input[name=number]').val(), | |
cvc: $('input[name=cvv]').val(), | |
exp_month: expMonthAndYear[0], | |
exp_year: expMonthAndYear[1] | |
}, stripeResponseHandler); | |
}); | |
var stripeResponseHandler = function(status, response) { | |
if (response.error) { | |
// Show appropriate error to user | |
} else { | |
// Get the token ID: | |
var token = response.id; | |
// Save token mapping it to customer for all future payment activities | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment