Created
March 4, 2020 22:52
-
-
Save tommyp/fc317f3dcdc3616eca975a460121e82e to your computer and use it in GitHub Desktop.
This file contains 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
<% 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