Skip to content

Instantly share code, notes, and snippets.

Created December 23, 2013 16:47
Show Gist options
  • Save anonymous/8100390 to your computer and use it in GitHub Desktop.
Save anonymous/8100390 to your computer and use it in GitHub Desktop.
<script src="https://checkout.stripe.com/checkout.js"></script>
<button id="customButton">Purchase</button>
<script>
var handler = StripeCheckout.configure({
key: 'pk_test_ahu1YHgH8D5BMaKmm3IX3aav',
image: '/square-image.png',
token: function(token, args) {
// Use the token to create the charge with a server-side script.
}
});
document.getElementById('customButton').addEventListener('click', function(e) {
// Open Checkout with further options
handler.open({
name: 'S x 3',
description: '2 widgets ($20.00)',
amount: 2000
});
e.preventDefault();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment