Add the script to your HTML file:
<meta name="viewport" content="initial-scale=1, width=device-width" />
<meta name="theme-color" content="#000000" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" />
<script src="https://telegram.org/js/telegram-web-app.js"></script>
Add the script inside the body tag of your HTML file:
<script src="https://unpkg.com/plutosdk@latest/dist/pluto-sdk.js"></script>
ℹ️ If you don't want auto-update the library, pass concrete version instead of latest
, e.g.
<script src="https://unpkg.com/plutosdk@0.0.1/dist/pluto-sdk.js"></script>
You can use global variable PlutoSDK
PlutoSDK.init()
It returns a promise that resolves after init success.
PlutoSDK.login()
It returns a promise that resolves after login success.
PlutoSDK.ready()
This method is called after login is complete. Call this method at the appropriate time to notify the SDK to delete the loading animation.
PlutoSDK.share()
This method is shared in telegram.
PlutoSDK.purchase(name, orderId, amount, customData, callback)
This method accepts the name orderId amount customData callback
as parameters. customData
and callback
are optional parameters.
Please note that the this pointer of the callback method callback
will be changed.
PlutoSDK.getShareLink()
This method is get share link.
PlutoSDK.copyShareLink()
This method is copy share link to clipboard.
PlutoSDK.getItem(key)
This method that receives a value from the server using the specified key. It returns a promise.
PlutoSDK.setItem(key, value)
This method that stores a value in the server using the specified key. It returns a promise.