Created
March 25, 2016 00:44
-
-
Save jimboobrien/777b5a588dcba29ac82e 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
<script src="https://checkout.stripe.com/checkout.js"></script> | |
<button id="customButton">Purchase</button> | |
<script> | |
var handler = StripeCheckout.configure({ | |
key: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX', | |
image: '/img/documentation/checkout/marketplace.png', | |
locale: 'auto', | |
token: function(token) { | |
// Use the token to create the charge with a server-side script. | |
// You can access the token ID with `token.id` | |
} | |
}); | |
$('#customButton').on('click', function(e) { | |
// Open Checkout with further options | |
handler.open({ | |
name: 'Sun Pediatrics, LLC', | |
description: '2 widgets', | |
amount: 2000 | |
}); | |
e.preventDefault(); | |
}); | |
// Close Checkout on page navigation | |
$(window).on('popstate', function() { | |
handler.close(); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment