· 6 years ago · Sep 05, 2019, 01:06 AM
1<!DOCTYPE html>
2<html>
3 <head>
4 <script src="https://js.stripe.com/v3/"></script>
5 <?php include './vendor/autoload.php';?>
6 <?php include "checkout.php"; ?>
7 </head>
8
9 <body>
10 hello little buddy
11 <script>
12 var stripe = Stripe('-my stripe test key-');
13
14 //get javascript session object.
15 var obj = '<?php echo json_encode($session); ?>';
16 var js_obj_data = JSON.parse(obj);
17
18 stripe.redirectToCheckout({
19 // Make the id field from the Checkout Session creation API response
20 // available to this file, so you can provide it as parameter here
21 // instead of the {{CHECKOUT_SESSION_ID}} placeholder.
22 sessionId: js_obj_data.id
23 }).then(function (result) {
24 // If `redirectToCheckout` fails due to a browser or network
25 // error, display the localized error message to your customer
26 // using `result.error.message`.
27 console.log('error!');
28 });
29
30 window.addEventListener("beforeunload", function() { debugger; }, false)
31 </script>
32 </body>
33
34
35</html>