Created
December 6, 2013 16:49
-
-
Save andrewpthorp/7828107 to your computer and use it in GitHub Desktop.
Sample Dynamic Emails in Stripe Checkout.
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
<html> | |
<body> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script src="https://checkout.stripe.com/checkout.js"></script> | |
<input type="email" class="email-field" /> | |
<button id="customButton">Purchase</button> | |
<script> | |
var handler = StripeCheckout.configure({ | |
key: '<YOUR PUBLIC API KEY>', | |
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: 'Site Name', | |
description: 'Product Description', | |
amount: 2000, // Product Amount | |
email: $('.email-field').val() | |
}); | |
e.preventDefault(); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment