question

Robyn To avatar image
Robyn To asked

Economy V2 PurchaseInventoryItems

Is it possible to use a Store's friendly Id instead of StoreId for purchasing?

Alternatively, is there a way to get a store's Id from the friendly Id? I am working across multiple PlayFab titles (Development, Production) and the Id is not consistent, but the friendly Id can be.

For example, this is the request I am currently able to make without friendly Id:

 {
   "Amount": 1,
   "DeleteEmptyStacks": true,
   "CustomTags": {},
   "Entity": {  
       "Id": "A8968570B030F54C",
       "Type": "title_player_account",
       "TypeString": "title_player_account"
   },
   "Item": {
     "AlternateId": 
         {
             "Type": "FriendlyId",
             "Value": "7B4E2037-306D-45A4-A85D-BABDDDB12B28"
         },
     "StackId": "default"
   },
   "PriceAmounts": [
     { 
         "ItemId": "d1aaf737-ed12-4666-8b0b-7024ab19e9d9",
         "Amount": 50
     }
   ],
   "StoreId": "d1112718-9768-4982-8f51-801768d7e2f5"
 }
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.

kylemc@microsoft.com avatar image
kylemc@microsoft.com answered

You can also get a Store Id from the Friendly Id using GetItem.

 {
     "AlternateId": { "Type": "FriendlyId", "Value": "{MyFriendlyId}" }
 }

It's a faster and more efficient call. It's a great suggestion, though. We want to make it easier to use FriendlyIds in more places.

10 |1200

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

Xiao Zha avatar image
Xiao Zha answered

Currently, PlayFab doesn’t provide such feature for you to use a Store's friendly Id instead of StoreId for purchasing. You may post a feature request for it. But you can get a store's Id from the friendly Id using SearchItems API with Filter. For example: "Filter": "Type eq 'store' and alternateIds/any(a: a/Value eq 'PriceTest')" is used to search for the Store with FriendlyId: “PriceTest”.

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.