Set up your first virtual currency
Economy v2 is now Generally Available. For support and feedback, go to the PlayFab Forum.
Prerequisites
- A PlayFab developer account
- The PlayFab Beta SDK (You can find more information on the Postman Quickstart)
Get a title entity token
To make changes to your title config data via the APIs, you first need to obtain a title entity token. You can find more information on the Postman QuickstartCreate a new virtual currency
To create a new virtual currency, you need to create a Draft Item of type Currency.Game Manager
- Navigate to the Economy tab in Game Manager and select Catalog (V2).
- Choose Currency and select New currency.
- Edit the Title and add a Description - for example,
Diamonds,Our in-game currency of choice.. - Select Save and publish to complete your changes.
- Observe your currency in the Currency list.
REST API
Call CreateDraftItem. Use the following body:- The
FriendlyIdis the currency code, which can contain between one and three alphanumeric values - The
Titleis the display name that is shown to the players ContentTypeis a categorization of Economy items. You must first set the Content Type in ⚙️ > Title Settings > Economy > Catalog (V2) Settings.StartDateis a datetime string representing when the currency is visible to the players (default is the time of creation)
Troubleshooting
- Missing/expired entity token
- If you’re attempting to call
CreateDraftItemand receive a401: Unauthorizederror, you may have forgotten to get a title entity token, or it might be expired
- If you’re attempting to call
- The content type
''isn’t supported- If you’re attempting to call
CreateDraftItemand receive aCatalogBadRequestwith the above message, you need to first create a content type in the catalog settings tab under your title’s settings page in Game Manager
- If you’re attempting to call
Next steps
Now that you set up your first virtual currency, you can:- Add the currency to PlayFab Bundles you sell in app stores.
- Have the game server reward the currency to your players with AddInventoryItems.
- Assign prices to Catalog Items corresponding to the currency.
- Allow players to purchase Catalog Items with the currency using PurchaseInventoryItems.
