Skip to content

Instantly share code, notes, and snippets.

@heyalexej
Created January 25, 2014 16:51
Show Gist options
  • Save heyalexej/8619330 to your computer and use it in GitHub Desktop.
Save heyalexej/8619330 to your computer and use it in GitHub Desktop.
<script src="https://checkout.stripe.com/checkout.js"></script>
<button id="btn2" class="btn btn-success btn-lg btn-block">
<span class="text-uppercase"><span class="text-white-dark">Buy now for</span> $<%= "#{settings.price2}" %></span>
</button>
<script>
var handler = StripeCheckout.configure({
key: 'pk_test_1DU6AgiPLPgyzdgvhHy3jTVb',
image: '<%= settings.image_link %>',
token: function(token, args) {
// Use the token to create the charge with a server-side script.
}
});
document.getElementById('btn2').addEventListener('click', function(e) {
// Open Checkout with further options
handler.open({
name: '<%= "#{settings.homepage}" %>',
description: '<%= "#{settings.price2_value} - Set" %>',
amount: <%= "#{settings.price2}" %>,
billingAddress: "true",
shippingAddress: "true"
});
e.preventDefault();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment