Skip to content

Instantly share code, notes, and snippets.

@ArunGupta25
Created July 2, 2012 17:03
Show Gist options
  • Save ArunGupta25/3034293 to your computer and use it in GitHub Desktop.
Save ArunGupta25/3034293 to your computer and use it in GitHub Desktop.
function stripeResponseHandler(status, response) {
if (response.error) {
// show the errors on the form
$(".payment-errors").text(response.error.message);
$(".submit-button").removeAttr("disabled");
} else {
var form$ = $("#payment-form");
// token contains id, last4, and card type
var token = response['id'];
// insert the token into the form so it gets submitted to the server
form$.append("<input type='hidden' name='stripeToken' value='" + token + "'/>");
// and submit
form$.get(0).submit();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment