Skip to main content
Economy v2 is now Generally Available. For support and feedback, go to the PlayFab Forum.
Economy v1 (Legacy) had a built-in Containers feature—special catalog items that, when opened, granted their contents to the player’s inventory. Economy v2 doesn’t include containers as a native item type, but you can achieve the same behavior for fixed-contents containers (containers that always grant the same items) by using a combination of virtual currency and bundles.

How it works

The pattern uses three Economy v2 building blocks:
  1. A virtual currency (or stackable item) that represents the container itself—for example, “Treasure Chest Token.”
  2. A Bundle priced at 1 of that currency, containing the items the container should grant.
  3. A purchase call where the player spends 1 token to buy the bundle, which automatically unpacks and grants the items.
From the player’s perspective, they receive a token (via gameplay rewards, store purchases, and so on), then “open” it to get the items inside—exactly how V1 containers worked.

Prerequisites

Step 1: Create a virtual currency for the container

Create a virtual currency that represents the container. Each unit of this currency acts as one unopened container.

Game Manager

  1. Go to Economy > Catalog (V2) > Currency.
  2. Select New currency.
  3. Set the Title to a descriptive name, such as Treasure Chest.
  4. Set the FriendlyId to a short code, such as tc.
  5. Select Save and publish.

REST API

Call CreateDraftItem:

Step 2: Create a bundle priced at one container token

Create a bundle that contains the items you want the container to grant. Price the bundle at exactly one unit of the container currency.

Game Manager

  1. Go to Economy > Catalog (V2) > Bundles.
  2. Select New bundle.
  3. Set the Title to describe the container’s contents, such as Treasure Chest Contents.
  4. Under Items, add the items and quantities you want the container to grant—for example, 1 Legendary Sword and 100 Gold.
  5. Under Price, set the price to 1 of your container currency (Treasure Chest).
  6. Select Save and publish.

REST API

Call CreateDraftItem:

When a player purchases this bundle, the bundle is automatically unpacked—the individual items go directly to the player’s inventory.

Step 3: Grant container tokens to players

Grant the container currency to players through any mechanism that fits your game design:
  • Gameplay rewards—Grant tokens after completing a level, quest, or achievement by using AddInventoryItems.
  • Store purchases—Sell the container token in a Store for another virtual currency or real money.
  • Battle pass / seasonal rewards—Include the token as a reward tier.
Example using AddInventoryItems to grant three Treasure Chest tokens:

Step 4: Open the container

When the player wants to open a container, call PurchaseInventoryItems to buy the bundle with one container token:
After a successful call, the player’s inventory is updated: One Treasure Chest token is deducted and the bundle’s contents (one Legendary Sword + 100 Gold) are added.

Multiple container types

Create multiple container types by repeating this pattern. For example: Each container type has its own currency and bundle.

Using a Store for container purchases

Use a Store to override the container bundle’s price. By using a store, you can offer the same container at different prices in different contexts (for example, a discounted “open” cost during an event):
Then pass the StoreId when purchasing:

Limitations

This pattern works for containers with fixed, deterministic contents. If you need randomized loot (where the contents vary each time a container is opened, similar to V1 containers paired with drop tables), see the Drop tables and randomized loot tutorial. This tutorial uses Azure Functions to:
  1. Subtract the container token from the player’s inventory.
  2. Run your weighted random selection logic.
  3. Grant the resulting items through the inventory APIs.

See also

Last modified on August 10, 2026