-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnexio-from-frontend.html
47 lines (40 loc) · 1.08 KB
/
nexio-from-frontend.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
<html lang="en">
<body>
<style>
html {
font-family: "arial",serif;
}
#iframe {
height: 1500px;
border: 0;
}
</style>
<script>
function loadIframe(otu) {
let iframe = document.getElementById('iframe');
iframe.src = 'https://api.nexiopaysandbox.com/pay/v3/saveCard?token=' + otu;
}
function getOneTimeUseToke() {
fetch('http://localhost:3000/', {
method: 'GET'
}).then(function (response) {
return response.json();
}).then((objData) => {
console.log('------->response Data', objData);
loadIframe(objData.token);
});
}
getOneTimeUseToke();
window.addEventListener('message', (message) => {
if (message.data.event === 'cardSaved') {
console.log(message.data.data.token.token);
alert('we saved a card! Here is your Credit Card Token: ' + message.data.data.token.token);
}
});
</script>
<div>
<h3>Credit Card Form</h3>
<iframe id="iframe" class="input-cc" src=""></iframe>
</div>
</body>
</html>