Skip to content

Instantly share code, notes, and snippets.

@marckohlbrugge
Forked from ziadoz/stripe-checkout.html
Last active April 20, 2017 19:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marckohlbrugge/7ae94f66f1c2863d5a56 to your computer and use it in GitHub Desktop.
Save marckohlbrugge/7ae94f66f1c2863d5a56 to your computer and use it in GitHub Desktop.
Custom Stripe Checkout Button
<style>
input[type="submit"] {
background-color: red;
color: white;
border-radius: 5px;
border: none;
font-size: 28px;
padding: 20px;
}
</style>
<form action="." method="post">
<noscript>You must <a href="http://www.enable-javascript.com" target="_blank">enable JavaScript</a> in your web browser in order to pay via Stripe.</noscript>
<input
type="submit"
value="Pay with Card"
data-key="PUBLISHABLE STRIPE KEY"
data-amount="500"
data-currency="cad"
data-name="Example Company Inc"
data-description="Stripe payment for $5"
/>
<script src="https://checkout.stripe.com/v2/checkout.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
<script>
$(document).ready(function() {
$(':submit').on('click', function(event) {
event.preventDefault();
var $button = $(this),
$form = $button.parents('form');
var opts = $.extend({}, $button.data(), {
token: function(result) {
$form.append($('<input>').attr({ type: 'hidden', name: 'stripeToken', value: result.id })).submit();
}
});
StripeCheckout.open(opts);
});
});
</script>
</form>
@carlos94587
Copy link

any thoughts how can apply the script in a Webflow site? I added the basic piece of code but need to add a style to the button to match the site. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment