question

CRM avatar image
CRM asked

Questions about the specification of PlayFabClientAPI.PurchaseItem Unity

I have an issue where, when using PlayFabClientAPI.PurchaseItem to retrieve bundle drop items, I want to receive duplicate items if duplicates occur, but the duplicated items are not included in result.Items.

 private void PurchaseBundle(string storeId, string virtualCurrency, int price)
     {
         PlayFabClientAPI.PurchaseItem(new PurchaseItemRequest()
         {
             CatalogVersion = "test1",
             StoreId = "GachaStore",
             ItemId = storeId,
             VirtualCurrency = virtualCurrency,
             Price = price
         }, result =>
         {
             List<string> itemIds = new List<string>();
                
             foreach (var item in result.Items)
             {
                 string itemId = item.ItemId;
                  
                 itemIds.Add(itemId);
                   
             }
             for (int i = 0; i < itemIds.Count; i++)
             {
                 Debug.Log("itemID: " + itemIds[i]);
                   
             }

For example, when retrieving 11 bundle drop items:

1,2,3,4,5,6,7,8,10,10,10

it seems that if there are duplicate items with ID 10, one of them is omitted, and only the unique items are retrieved:

1,2,3,4,5,6,7,8,10

Is there a way to retrieve the duplicated item even if duplicates occur?

Player Dataapisunity3d
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

·
Gosen Gao avatar image
Gosen Gao answered

Duplicate items will be included in the result if that item is not stackable. But if the item is stackable, the duplicate items will be stacked as one and the field UsesIncrementedBy will tell you how many of that item you got.

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.