Skip to content

Instantly share code, notes, and snippets.

@jhonnrodr
Forked from elithrar/stripe-config.js
Last active August 29, 2015 14:20
Show Gist options
  • Save jhonnrodr/67ef68e7141ac2a575af to your computer and use it in GitHub Desktop.
Save jhonnrodr/67ef68e7141ac2a575af to your computer and use it in GitHub Desktop.
// Disable the payment/submit button until everything has loaded
// (if Stripe fails to load, we can't progress anyway)
$(document).ready(function() {
$("#payment-button").prop('disabled', false)
})
var handler = StripeCheckout.configure("customButtonA", {
key: '<yourpublishablekey',
token: function(token, args){
var $input = $('<input type=hidden name=stripeToken />').val(token.id);
$('form').append($input).submit();
}
});
('#payment-button').on('click', function(e){
$('#payment-button').prop('disabled', true);
setTimeout(function() {
$('#payment-button').prop('disabled', false);
}, 3000); // Sets a short timeout
handler.open({
amount: 7900,
image: "...",
name: "...",
description: "...",
panelLabel: "...",
currency: "...",
});
e.preventDefault();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment