-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuccess.html
60 lines (53 loc) · 1.56 KB
/
success.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<html>
<head>
<title>Thanks for your order!</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<script>
function getUserPurchaseDetails() {
var url = new URL(window.location.href);
var sessionId = url.searchParams.get("session_id");
var urlencoded = new URLSearchParams();
urlencoded.append("session_id", sessionId);
fetch("https://howreally.iauro.co/stripe/purchase-details" , {
method: "POST",
body : urlencoded,
headers: {"Content-type": "application/x-www-form-urlencoded",
"Access-Control-Allow-Credentials":true,
"Access-Control-Allow-Origin":"*",
"Access-Control-Allow-Methods":["POST","GET"],
"Access-Control-Allow-Headers":'Content-Type'}
})
.then(function (response) {
return response.json();
})
.then(function (result) {
if (result.error) {
console.log("error ", result.error)
alert(result.error.message || result.error.code)
}else {
console.log("final test", result)
document.getElementById("username").innerHTML = result.name;
document.getElementById("useremail").innerHTML = result.email;
}
})
.catch(function (error) {
alert("ERR: ",error);
console.log("error frontend2 ",error)
});
}
setTimeout(function() {
getUserPurchaseDetails()
}, 500);
</script>
<section>
<h3 id="username"></h3>
<h3 id="useremail"></h3>
<p>
We appreciate your business! If you have any questions, please email
<a href="mailto:orders@example.com">orders@example.com</a>.
</p>
</section>
</body>
</html>