Catalog v2 quickstart
Economy v2 is now Generally Available. For support and feedback, go to the PlayFab Forum.
- Set up a v2 Catalog’s permissions, settings, and items.
- Set up Receipt Validation
- Walk through purchasing an item
Part 1: Catalog overview
Step 1 – Get permissions
The first step is to enable the catalog in the settings page in the Game Manager UI under ⚙️ Title Settings > Economy (V2). You can use theUpdateCatalogConfig API and set the IsCatalogEnabled flag to true.
To interact with the Catalog, you either need to Log into GameManger and use the site tools, or get an Entity Token for using the APIs. The easiest way to get an entity token is with the GetEntityToken API.
To call the API as an admin or authoritative service, which you will need to do before you create your first Catalog item, you’ll need to include an X-SecretKey header with a title secret key. You can create title secret keys in the Game Manager UI under ⚙️ Title Settings > Secret Keys.
API
C# SDK
Step 2 - Configure your Catalog Settings
Catalog Settings include many different configurations, from Content Types to User-Generated Content. You can update and retrieve them all through the API, and easily visualize many of them in Game Manager.Game Manager
- In Game Manager, navigate to ⚙️ Title Settings > Economy.
- Under the Catalog (V2) tab, go to Catalog Settings
- Create a default Content Type (creating a “Game Item” type is a good place to start).
API
Call the Catalog/GetCatalogConfig method, and then UpdateCatalogConfig the Catalog ContentTypes array with a Catalog Type.Step 3 - Publish an Item to the Catalog
GameManager
Navigate to Economy > Catalog (V2). Under the Items tab, select New Item. Fill in the required metadata – there are only four required properties (Creator Type, Title, Start date, and Content type). Select Publish.API
Create a “Draft” Catalog Item by calling the CreateDraftItem endpoint:- The EntityToken (from GetEntityToken or other PlayFab
logincall) in the X-EntityToken header - The PlayFab Title ID in the item’s CreatorEntity.Id
C# SDK
Putting the item into a Draft state is not required – Draft is meant for when you expect to iterate on the metadata for some period of time. We support the parameter “publish”, that when set to “true” will publish the item immediately. This could save you some call volume depending on your pattern.
Step 4 - Do a search
Once the Publish call succeeds, the Item can be searched for using the previously published ItemId and SearchItems endpoint. The Catalog/Search API executes a search against the published catalog using a set of parameters provided to the API, returning a set of paginated results.Game Manager
Game Manager search is self-explanatory and exists on each Catalog v2 page. Published and Draft filters are at the top. Select the Filters (Funnel) icon next to the Search button to see the list of filters. SelectEnter ODATA filter to add an OData filter.
API
Catalog/search filter, orderBy, and select fields use OData as the query standard.
Part 2: Inventory and Virtual Currencies overview
Inventory Items and Virtual Currencies are the two in-game ‘buckets’ of virtual goods that PlayFab supports for Player Entities. The process is:- Set up an initial Virtual Currency
- Create an Item with a Virtual Currency Cost
- Add the item to a player’s Inventory
Step 1: Creating a Currency
Virtual currencies are the foundation of in-game economies. Players and characters can be granted these currencies, which can then be used to buy or trade items. Items can have a cost in either a virtual currency or real money. Each title can support multiple arbitrary virtual currencies. Currencies provide flexibility for your game to implement whatever medium of exchange you desire (for example, gold, gems, hearts, or interstellar credits).Game Manager
- Open Game Manager and go to Economy > Catalog (V2).
- Select the Currency tab.
- Choose New Currency, setting the Start date, a human-readable Title for the “neutral” key, and in the Friendly ID field, enter a unique currency code for this currency.
- Select Save as draft. The Item ID is used as a draft currency code.
- View your new currency by clicking selecting the Draft filter in the currency list.
- Edit the currency again and select Save and publish. The Friendly ID is used as a published currency code.
API
Create a Draft Currency Catalog Item by calling the CreateDraftItem endpoint with type set to “currency” using:- An EntityToken with Catalog Permissions
- The Entity.Id as the item ‘Creator’
- The PlayFab Title ID
- The Item should be a Bundle of type ‘Currency’ and contain a Title and Description
Step 2 - Granting Currencies
Game Manager
Your entity player needs virtual currency in order to make a Purchase.- Open GameManager, navigate to Players, and select Search to retrieve the list of players.
- Select the Player ID you wish to grant currency to.
- Select the Inventory (V2) tab.
- Filter to “Currency” Type and select Pick multiple items to view the full list of currencies.
- Choose the Currency you created and enter a new amount for the Entity Player.
- Select Save.
API
You can call AddInventoryItems to add currency to an Entity Wallet. By default, you need to use Title Level Entity Auth to arbitrarily add virtual currencies to a player’s inventory.AddInventoryItems is considered a Title admin call, and is normally not something called directly by the game client.
Step 3 - Update a Catalog Item
An item must have a currency value in order for it to be purchasable with virtual currency.GameManager
- Open Game Manager and navigate to Economy.
- Select the Catalog (V2) tab and ensure you’re filtered to Published items.
- Select the title of the item you created earlier.
- Select Edit draft item.
- Select ➕ Add new price and set an Amount by selecting the Currency item you created. Select Add to finish.
- Select Save and Publish.
API
Get the draft of your Catalog Item by calling the GetDraftItem endpoint. Then update the draft with the UpdateDraftItem endpoint using:- The EntityToken (from GetEntityToken or other PlayFab
logincall) in the X-EntityToken header - The Entity.Id from the previous call in the item’s EntityKey.Id
Publish to true, then you must push it to the published state using PublishDraftItem. Once an Item is published, it’s searchable and available publicly. You need to use the “itemId” returned from the GetDraftItem response in order to publish.
