-
-
Save bran921007/9cd0fb210fe2966a9a85 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
// 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