question

amninov avatar image
amninov asked

Economyv2 GetUserInventory always returns empty VirtualCurrency in postman

Hello

I'm new to the PlayFab and just started. Followed this guide step-by-step to create Currency https://learn.microsoft.com/en-us/gaming/plafab/features/economy-v2/tutorials/currencies?tabs=create-currency-gm Added the currency to a user using PlayFab web console.

Then using postman, LoginWithCustomID and GetUserInventory always returns empty: { "code": 200, "status": "OK", "data": { "PlayFabId": "2E3E38E8DB28912D", "Inventory": [], "VirtualCurrency": {}, "VirtualCurrencyRechargeTimes": {} } }

The new title had Legacy Currency and Economy used and it was working. So, I deleted these and created Currency in Economyv2 and now it does not work.

Player Inventory
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Neils Shi avatar image
Neils Shi answered

Please note that the API GetUserInventory is a Legacy Economy API, you can use it to retrieve the user's inventory of legacy virtual goods. But in your case, you want to retrieve the Economy v2 items from the player's inventory, then you should use Economy v2 API GetInventoryItems instead. For more info about the differences between Economy V2 and Legacy Economy, you can refer to Economy version 2 (V2) FAQ - PlayFab | Microsoft Learn. In addition, the API GetInventoryItems allows you specify the type of item (which you want to retrieve) via setting the parameter "Filter". If you want to retrieve the currency type items, you can refer to my example request body below.

 {
   "Count": 10,
   "Entity": {
                 "Id": "9C0E93xxxxxxxxx",
                 "Type": "title_player_account",
                 "TypeString": "title_player_account"
             }
    "Filter":"type eq 'currency'"
 }
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

amninov avatar image amninov commented ·

Thanks! That does help and allow me to return currency. However, it is strange it does not tell what type of currency is it

     {
         "code": 200,
         "status": "OK",
         "data": {
             "Items": [
                 {
                     "Id": "a0d0bb8f-45ce-43a0-9eff-1126f0f10389",
                     "StackId": "stackId",
                     "DisplayProperties": {},
                     "Amount": 360,
                     "Type": "currency"
                 },
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.