-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from xsolla/PAYMENTS-16028-status
Payments 16028 status
- Loading branch information
Showing
4 changed files
with
127 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<!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>Return page</title> | ||
<!-- | ||
Link the SDK bundle. | ||
NOTE: In this example, we use a local build just for convenience purposes. | ||
--> | ||
<script src="../../dist/main.js"></script> | ||
</head> | ||
|
||
<body> | ||
<h1>PayPal payment return page</h1> | ||
|
||
<!-- | ||
Add status component. It will take the necessary parameters from return url | ||
--> | ||
<psdk-status></psdk-status> | ||
|
||
<!-- | ||
Add legal component to provide links to legal documents | ||
--> | ||
<psdk-legal></psdk-legal> | ||
|
||
<script> | ||
if (typeof PayStationSdk === 'undefined') { | ||
alert(` | ||
It seems SDK library is undefined. | ||
Please, link CDN source or create local build (recommended to test purposes only). | ||
`); | ||
throw new Error('PayStationSdk not found'); | ||
} | ||
/** | ||
* To learn more about creating tokens, | ||
* please read 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'); | ||
} | ||
|
||
/** | ||
* The SDK is available under the PayStationSdk namespace. | ||
* To begin initialization, obtain a reference to the headlessCheckout object. | ||
*/ | ||
const { headlessCheckout } = PayStationSdk; | ||
|
||
async function initPayStationSdk() { | ||
/** | ||
* 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. | ||
* You can set sandbox payment mode with `sandbox` parameter | ||
* Please note that this command executes asynchronously. | ||
*/ | ||
await headlessCheckout.init({ | ||
isWebView: false, | ||
sandbox: true, | ||
}); | ||
|
||
/** | ||
* After the Payments SDK has been initialized, the next step is setting the token. | ||
* To learn more about creating tokens, | ||
* please read https://developers.xsolla.com/api/pay-station/operation/create-token/ | ||
*/ | ||
await headlessCheckout.setToken(accessToken); | ||
} | ||
|
||
// initialize sdk | ||
initPayStationSdk(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters