Skip to content

Instantly share code, notes, and snippets.

@tommyp
Created March 4, 2020 22:52
Show Gist options
  • Save tommyp/fc317f3dcdc3616eca975a460121e82e to your computer and use it in GitHub Desktop.
Save tommyp/fc317f3dcdc3616eca975a460121e82e to your computer and use it in GitHub Desktop.
<% content_for :head do %>
<script src="https://js.stripe.com/v3/"></script>
<script type="text/javascript">
const setupStripe = () => {
const stripe = Stripe('pk_test_3rCk8Ewa2UTc79iWJZDCeKmH00plww4RXx');
document
.getElementById("checkout")
.addEventListener('click', (event) => {
stripe.redirectToCheckout({
sessionId: '<%= @stripe_session.id %>'
})
})
}
window.onload = setupStripe;
</script>
<% end %>
<div class="content">
<p>Nice to meet you <%= @ticket.name %>!</p>
<p>We reserved your ticket for 5 minutes.</p>
<p>Please complete the purchase using your test credit card</p>
<button id="checkout">Checkout</button>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment