Created
November 27, 2013 00:40
-
-
Save elithrar/7668881 to your computer and use it in GitHub Desktop.
Example Stripe Checkout - Custom Integration for #stripe
This file contains 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
What if the dialogue is cancelled (not just closed, which is also called on success).