Sep 12, 2021
3
Level 6
Laravel and Stripe checkout
According to the Stripe documentation, it's necessary to include stripe.js:
<!DOCTYPE html>
<html>
<head>
<title>Buy cool new product</title>
<link rel="stylesheet" href="style.css">
<script src="https://polyfill.io/v3/polyfill.min.js?version=3.52.1&features=fetch"></script>
<script src="https://js.stripe.com/v3/"></script>
</head>
<body>
<section>
<div class="product">
<img
src="https://i.imgur.com/EHyR2nP.png"
alt="The cover of Stubborn Attachments"
/>
<div class="description">
<h3>Stubborn Attachments</h3>
<h5>.00</h5>
</div>
</div>
<form action="/create-checkout-session.php" method="POST">
<button type="submit" id="checkout-button">Checkout</button>
</form>
</section>
</body>
</html>
If you are using Laravel chachier Stripe to generate the session id, and then perform the redirect to the stripe hosted checkout page, it seems like the stripe.js isn't necessary.
Visit: https://laravel.com/docs/8.x/billing#product-checkouts
Anyone know the purpose to load the stripe.js on the client side, when using Stripe Checkout?
Please or to participate in this conversation.