@xsolla/payouts-sdk
v0.1.6
Published
## Getting started
Downloads
16
Readme
Mass payouts widget sdk
Getting started
Your node version should be >= 16
npm install
cp ./ci/.env.example ./.env
npm run start
Install and use
If you use npm
npm i @xsolla/payouts-sdk
import { Widget } from "@xsolla/payouts-sdk";
const options = {
token: /<your token>/,
lang: /<your locale>/,
theme: /<your theme>/,
size: /<your size>/,
sandbox: boolean
}
const widget = new Widget(options);
widget.show(/<tag id>/);
If you use script
<script>
const options = {
token: /<your token>/,
lang: /<your locale>/,
theme: /<your theme>/,
size: /<your size>/,
sandbox: boolean
}
const id = /<tag id>/
const s = document.createElement('script');
s.type = "text/javascript";
s.async = true;
s.src = "santorelli.min.js";
s.addEventListener('load', function () {
const widget = new XPayoutsWidget.Widget(options);
widget.show(id);
}, false);
const head = document.getElementsByTagName('head')[0];
head.appendChild(s);
</script>
...
<body>
...
<div id="/<tag id>/"></div>
...
</body>
Types
type Options = {
token: string;
lang?: 'ru' | 'en'; //default 'en'
theme?: 'black' | 'white'; //default 'black'
size?: 'auto' | 'fixed'; //default 'fix'
sandbox?: boolean; //default 'false'
}
Event listeners
widget.addEventListener(event: EventType, callback: (data: DataType) => void);
| EventType | DataType | |---------------------|------------------| | 'load' | empty | | 'abort' | empty | | 'tokenExpired' | empty | | 'heightResize' | {height: number} | | 'requestWithdrawal' | {amount: number} |