Playtolia Wallet API allows you to manage virtual currencies and track player balances. The Wallet API supports multiple currencies, automatic balance updates after purchases, and synchronization across devices. Use PlaytoliaWallet to get currency information, check player balances, and listen to balance changes.
Wallet data is only available after successful authentication. PlaytoliaWallet functions will return empty lists or null values until the player is logged in.
Import the PlaytoliaSDK.Runtime to your script by adding the using directive
WalletController.cs
Copy
using PlaytoliaSDK.Runtime;
Call the GetWallets function to retrieve all player wallet items
WalletController.cs
Copy
// Get all player walletsvar wallets = PlaytoliaWallet.GetWallets();
Once you authenticate your user, PlaytoliaWallet will automatically refresh and fetch the latest wallet balances. If you need to refresh the wallet data manually, simply use PlaytoliaWallet.Refresh() function.
You can get a specific wallet using different currency identifiers
WalletController.cs
Copy
// Get wallet by currency IDvar walletById = PlaytoliaWallet.GetWalletForCurrencyWithId("gold_currency_id");// Get wallet by currency codevar walletByCode = PlaytoliaWallet.GetWalletForCurrencyWithCode("GOLD");// Get wallet by Currency objectCurrency goldCurrency = PlaytoliaWallet.GetCurrencyByCode("GOLD");var walletByCurrency = PlaytoliaWallet.GetWallet(goldCurrency);
PlaytoliaWallet provides functions to retrieve and work with currency definitions
WalletController.cs
Copy
// Get all available currenciesvar currencies = PlaytoliaWallet.GetCurrencies();// Get currency by IDvar currencyById = PlaytoliaWallet.GetCurrencyById("gold_currency_id");// Get currency by codevar currencyByCode = PlaytoliaWallet.GetCurrencyByCode("GOLD");