-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
70 lines (64 loc) · 2.2 KB
/
index.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
61
62
63
64
65
66
67
68
69
70
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
/>
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<!--
Link the SDK bundle.
NOTE: In this example, we use a local build just for convenience purposes.
-->
<script src="../../dist/main.js"></script>
<script src="../variables.js"></script>
<link rel="stylesheet" href="../../dist/style.css" />
</head>
<body>
<h1>Pay Station SDK</h1>
<psdk-legal></psdk-legal>
<!-- Initialization script -->
<script>
if (typeof PayStationSdk === 'undefined') {
alert(payStationSdkUndefinedError);
throw new Error('PayStationSdk not found');
}
/**
* To learn more about creating tokens,
* refer to https://developers.xsolla.com/api/pay-station/operation/create-token/
*/
const accessToken = '';
if (!accessToken) {
alert(`No token provided. Please, check the documentation`);
throw new Error('No token provided');
}
async function initPayStationSdk() {
/**
* The SDK is available under the PayStationSdk namespace.
* To begin initialization, obtain a reference to the headlessCheckout object.
*/
const { headlessCheckout } = PayStationSdk;
/**
* Call the `init()` method with the provided environment object.
* The isWebView parameter is required and indicates whether your
* integration type is a WebView or not.
* Please note that this command executes asynchronously.
*/
await headlessCheckout.init({
isWebView: false,
sandbox: true,
theme: 'default',
});
/**
* After the Payments SDK has been initialized, the next step is setting the token.
* To learn more about creating tokens,
* refer to https://developers.xsolla.com/api/pay-station/operation/create-token/
*/
await headlessCheckout.setToken(accessToken);
}
initPayStationSdk();
</script>
</body>
</html>