Im not sure if someone can assist here. I am following a basic example at
I have created the HTML and added the code as below including the Javascript as required
<!DOCTYPE html>
<script src="https://js.stripe.com/v3/"></script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<button onclick="checkout()">Check Out</button>
</form>
</body>
</html>
<script type="text/javascript">
function checkout() {
var stripe = Stripe('pk_test_KEY');
stripe.redirectToCheckout({
// Make the id field from the Checkout Session creation API response
// available to this file, so you can provide it as parameter here
// instead of the {{CHECKOUT_SESSION_ID}} placeholder.
sessionId: '123456789'
}).then(function (result) {
// If `redirectToCheckout` fails due to a browser or network
// error, display the localized error message to your customer
// using `result.error.message`.
});
}
</script>
When i click the button it doesnt redirect to the payment gateway page. What am i missing?