Drag and drop prefab P00lsGamesSDK in your scene from Packages/P00LS Games SDK/Prefabs folder
npm install @p00ls-games/sdk
import { p00lsGamesSdk } from '@p00ls-games/sdk';
P00LS provides both an ES and UMD bundled version :
<script type="module">
// static import
import {p00lsGamesSdk} from 'https://cdn.jsdelivr.net/npm/@p00ls-games/sdk@4/index.es.js';
// or dynamic import
const {p00lsGamesSdk} = await import(`https://cdn.jsdelivr.net/npm/@p00ls-games/sdk@${sdkVersion}/index.es.js`);
</script>
To access the UMD version, replace .es by .umd
Setup
Bind the P00lsGamesSDK into your script (or use any other means you prefer to access the SDK instance)
You're all set, you can now use the SDK in your project.
Keep in mind this is an aysnc operation, so you should wait for the SDK to be fully initialized before attempting any action on it.
(async function() {
const sdk = await p00lsGamesSdk();
// Tells p00ls games sdk your game is operational. Mandatory call.
sdk.tma.ready();
/*
Saves sdk instance somewhere you can access it,
or pass it along your own setup function.
You should avoid if possible storing it in global context.
*/
})();
Configure in-app purchases
Given how telegram invoices work, you need to implement a global callback that will receive all invoices feedbacks.