Skip to content

Use Wallets In-Game

This how-to retrieves a Player's or Character's Wallet, and credits or debits Currency balances from your game.

Prerequisites

Retrieve a Wallet

Get Player Wallet by Holder ID

string holderUlid; // holderUlid can be found in the Start Session response as response.player_ulid
LootLocker.LootLockerEnums.LootLockerWalletHolderTypes player = LootLocker.LootLockerEnums.LootLockerWalletHolderTypes.player;
LootLockerSDKManager.GetWalletByHolderId(holderUlid, player, (response) =>
{
if(!response.success)
{
// If a wallet isn't found, one is automatically created for the holder.
Debug.Log("error: " + response.errorData.message);
Debug.Log("request ID: " + response.errorData.request_id);
return;
}
});

See the Reference Documentation for the full response.

Get Character Wallet by Holder ID

string holderUlid; // holderUlid can be found in the Start Session response as response.player_ulid
LootLocker.LootLockerEnums.LootLockerWalletHolderTypes character = LootLocker.LootLockerEnums.LootLockerWalletHolderTypes.character;
LootLockerSDKManager.GetWalletByHolderId(holderUlid, character, (response) =>
{
if(!response.success)
{
// If a wallet isn't found, one is automatically created for the holder.
Debug.Log("error: " + response.errorData.message);
Debug.Log("request ID: " + response.errorData.request_id);
return;
}
});

See the Reference Documentation for the full response.

Get Wallet by Wallet ID

string walletID = "";
LootLockerSDKManager.GetWalletByWalletId(walletID, (response) =>
{
if(!response.success)
{
Debug.Log("error: " + response.errorData.message);
Debug.Log("request ID: " + response.errorData.request_id);
return;
}
});

See the Reference Documentation for the full response.

List Balances in a Wallet

string walletID = "";
LootLockerSDKManager.ListBalancesInWallet(walletID, (response) =>
{
if(!response.success)
{
Debug.Log("error: " + response.errorData.message);
Debug.Log("request ID: " + response.errorData.request_id);
return;
}
});

See the Reference Documentation for the full response.

Credit or Debit a Wallet

Credit Wallet

string walletID = "";
string currencyID = "";
string amount = "100";
LootLockerSDKManager.CreditBalanceToWallet(walletID, currencyID, amount, (response) =>
{
if(!response.success)
{
Debug.Log("error: " + response.errorData.message);
Debug.Log("request ID: " + response.errorData.request_id);
return;
}
});

See the Reference Documentation for the full response.

Debit Wallet

string walletID = "";
string currencyID = "";
string amount = "100";
LootLockerSDKManager.DebitBalanceToWallet(walletID, currencyID, amount, (response) =>
{
if(!response.success)
{
Debug.Log("error: " + response.errorData.message);
Debug.Log("request ID: " + response.errorData.request_id);
return;
}
});

See the Reference Documentation for the full response.

Conclusion

You've retrieved a Wallet and adjusted its Currency balances from your game. Next, review LootLocker's full feature set to decide which other features to implement.