-
Notifications
You must be signed in to change notification settings - Fork 0
/
stpsuccess.html
57 lines (52 loc) · 4.23 KB
/
stpsuccess.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Payment Success</title>
</head>
<body style="display: flex;flex-direction: column;align-items: center; padding-top: 10vh;">
<svg t="1655954688405" class="icon" viewBox="0 0 1025 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2150" width="80" height="80"><path d="M511.85139 1024c-69.098781 0-136.100634-13.580107-199.308045-40.241053-61.010629-25.762262-115.730473-62.708142-162.76158-109.739249-47.031107-47.031107-83.877133-101.750951-109.739249-162.76158C13.481424 648.150561 0.00117 581.148708 0.00117 512.049927s13.580107-136.100634 40.241053-199.308045c25.762262-61.010629 62.708142-115.730473 109.739249-162.76158s101.750951-83.877133 162.76158-109.739249C375.750756 13.679961 442.752608 0.099854 511.85139 0.099854c69.098781 0 136.100634 13.580107 199.308044 40.241053 61.010629 25.762262 115.730473 62.708142 162.76158 109.739249 47.031107 47.031107 83.877133 101.750951 109.739249 162.76158 26.660946 63.107557 40.241053 130.209264 40.241053 199.308045s-13.580107 136.100634-40.241053 199.308044c-25.762262 61.010629-62.708142 115.730473-109.739249 162.76158-47.031107 47.031107-101.750951 83.877133-162.76158 109.739249-63.107557 26.461238-130.209264 40.041346-199.308044 40.041346z m0-983.958654c-260.21882 0-472.008581 211.689907-472.008582 472.008581 0 260.21882 211.689907 472.008581 472.008582 472.008581 260.21882 0 472.008581-211.689907 472.008581-472.008581 0-260.21882-211.689907-472.008581-472.008581-472.008581z m-70.796295 676.50902c-5.192394 0-10.484642-0.998537-15.277621-3.19532-8.487567-0.79883-16.475865-4.29371-22.167528-9.885519L235.256558 544.102974l-0.199708-0.199707c-13.779815-13.779815-13.779815-38.044271 0-51.824086 13.779815-13.779815 37.74471-13.779815 51.624379-0.199708l148.881911 140.993467 301.058996-317.634715 0.199707-0.199707c6.490492-6.490492 15.976597-10.284934 25.96197-10.284934s19.371624 3.794442 25.96197 10.284934c13.779815 13.779815 13.779815 37.74471 0.199707 51.624378l-321.728718 339.502682-0.199707 0.199707c-6.889907 6.6902-16.376012 10.18508-25.96197 10.185081z" fill="#11c139" p-id="2151"></path></svg>
<div style="width: 200px; margin: 32px auto; text-align: center; font-size: 24px; font-weight: 600;">Payment successful!</div>
<div id="" style="width: 200px;border-bottom: 1px solid #41c7b7; margin: 32px auto;"></div>
<div style="width: 200px; margin: 32px auto; text-align: center; font-size: 24px; ">Amount paid</div>
<div style="width: 200px; margin: 32px auto; text-align: center; font-size: 24px; ">
<span style="margin-right: 16px;">SGD</span><span id="money" class="numberAdd"></span>
</div>
<button id="actionBtn" style="color:#fff;height:45px;width:200px;border:none;background-color:#41c7b7;margin:20px;border-radius:5px;font-size: 16px;font-weight: 600;" onclick="returnApp()">Next</button>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
function parseQueryString(url) {
const obj = {}
const reg = /([^?&=]+)=([^?&=]*)/g
url.replace(reg, (m, $1, $2) => {
obj[$1] = $2
})
return obj
}
const queryParams = parseQueryString(location.href);
const sessionId = queryParams?.session_id;
const amount = queryParams?.amount; // paynow prop
if (amount) {
let moneys = document.getElementsByClassName("numberAdd")[0];
moneys.innerHTML = (amount / 100).toFixed(2);
} else if (sessionId) {
axios.get( "/adhocpayment/api/stripe/checkout-session", {params: { sessionId: sessionId }}).then(res => {
let moneys = document.getElementsByClassName("numberAdd")[0];
moneys.innerHTML = ((res.data.amount - 0) / 100).toFixed(2);
})
}
var data = {
session_id: sessionId,
status: 'success',
}
function returnApp() {
if (window.ReactNativeWebView && window.ReactNativeWebView.postMessage) {
window.ReactNativeWebView.postMessage(JSON.stringify(data));
} else {
window.history.go(-1);
}
}
</script>
</body>
</html>