P00LS Games SDK Help

In-app Purchases

Players can buy either items or virtual currency in your game.

It is your responsibility to define item ids. Title, description and currency name are for display purposes only and can be changed at any time.

Given how Telegram operates, you must define a single callback to receive payment results events. Refer to Configure In-app purchase.

Your callback will be invoked with a structure looking like:

{ paymentId: string; purchaseParams: PurchaseParams; status: InvoiceStatus; }

Where:

paymentId

Internal id for this payment.

purchaseParams

The initial purchase params you sent

status

One of paidfailedpendingcancelled

Buy item

Title and description will be displayed in the invoice to the user, so they should be readable. itemId on the other hand is your own internal reference to the item. Ideally, you should maintain an item inventory somewhere in your code base, where itemIds will be immutable, but where you can change title and description at will.

sdk.InitPurchase(new PurchaseItemParams { itemId = "itemId", description = "Test purchase", price = 1, quantity = 2, title = "Purchase" });
await sdk.purchase.initPurchase({ itemId: 'bad_sword_01', title: 'Big sword', description: 'Slain your foes with style', quantity: 3, price: 1, });

Buy In-game currency

Symbol and name parameters refers to the In-game currency, not Telegram STARS.

sdk.InitPurchase(new PurchaseCurrencyParams { name = "Game Coins", symbol = "GOLD", price = 10, quantity = 100 });
await sdk.purchase.initPurchase({ symbol: 'GOLD', name: 'Game coins', price:1, quantity:100 })
Last modified: 18 November 2024