Virtual Store #

Listing store items #

You can list available store items.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
foreach (var storeItem in economySystem.StoreItems)
{
    Debug.Log($"{storeItem.Name} - {storeItem.Description}). Cost: ");

    if (!string.IsNullOrEmpty(storeItem.Cost.Sku))
    {
        Debug.Log($"{storeItem.Cost.Sku}");
    }
    else
    {
        foreach (var currencyKvp in storeItem.Cost.Currencies)
        {
            Debug.Log($"{currencyKvp.Key}: {currencyKvp.Value}");
        }
    }
}

Refreshing the store #

You can refresh the economy system’s store data.

1
await economySystem.RefreshStoreAsync();

You can also specify the StoreType.

1
await economySystem.RefreshStoreAsync(StoreType.AppleAppStore);

Making a purchase intent #

You can make a purchase intent for a user, which is useful to differentiate product purchases that use the same SKU code.

1
await economySystem.PurchaseIntentAsync(storeItem);

Alternatively you can specify a store item id and SKU code.

1
await economySystem.PurchaseIntentAsync("<itemId1>", "<sku>");

Purchasing a store item #

You can purchase a store item for a user.

1
await economySystem.PurchaseStoreItemAsync("<itemId1>", "<receipt>");

Getting the active store type #

You can get the active store type.

1
Debug.Log($"Active store type is {economySystem.ActiveStoreType}");