question

Robyn To avatar image
Robyn To asked

ProfileVersion errors after doing AddInventoryItems

Does ProfileVersion update after adding inventory items in EconomyV2?

There is no updated profile version returned, but after executing Add Items, I get an error when trying to update my player objects with the profile version being off by 1.

Here is the order of operations:

SetObjects PlayFabRequest:

 {"Entity":{"Id":"A8968570B030F54C","Type":"title_player_account"},"ExpectedProfileVersion":121,"Objects":[{"DataObject":{"battlePassId":"6E8A27206E604B3DBE72199AF01B84E8","currentLevel":0,"currentXp":250001,"fetchDate":"2023.04.07-22.23.24","syncedToOnline":true},"ObjectName":"BattlePassProgress"}]}

SetObjects PlayFabResponse:

 {"ProfileVersion":122,"SetResults":[{"ObjectName":"BattlePassProgress","SetResult":"Updated"}]}

AddItemToPlayerInventory PlayFabRequest:

 {"Amount":2,"CollectionId":"default","Entity":{"Id":"A8968570B030F54C","Type":"title_player_account"},"Item":{"Id":"d1aaf737-ed12-4666-8b0b-7024ab19e9d9"}}

AddItemToPlayerInventory PlayFabResponse:

 {"IdempotencyId":"9dad0106-2df6-4389-b484-f7b588964562","TransactionIds":["40"]}

SetObjects PlayFabRequest:

 {"Entity":{"Id":"A8968570B030F54C","Type":"title_player_account"},"ExpectedProfileVersion":122,"Objects":[{"DataObject":{"battlePassId":"6E8A27206E604B3DBE72199AF01B84E8","currentLevel":0,"currentXp":275001,"fetchDate":"2023.04.07-22.23.28","syncedToOnline":true},"ObjectName":"BattlePassProgress"}]}

Error: SetObjectsFailed: The version 122 did not match the profile version of 123

apis
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

·
Simon Cui avatar image
Simon Cui answered

I did a test with your scenario. After post an Economy V2 AddInventoryItems API request, I checked the VersionNumber with Get Profile API and confirmed the VersionNumber did not change before and after using AddInventoryItems API. You may check if there was any other API call that changed the VersionNumner.

10 |1200

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

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.