question

seowebcart avatar image
seowebcart asked

Economy item inv

Hello everyone!!

Blockquote

public void MakePurchase(string name) { PurchaseItemRequest request = new PurchaseItemRequest();

  request.CatalogVersion = "Items";
  request.ItemId = name;
  request.VirtualCurrency = "DL";

  PlayFabClientAPI.PurchaseItem(request,
      result =>
      {
          UpdateInventory();

      },
      error =>
      {
          Debug.Log(error.ErrorMessage);
      });

}

Blockquote

whit this code i add just 1 item in inventory... could any of you tell me how I can send the contents of a public static int variable instead of just 1 object?? for example during the game I collect more objects of the same type that I save in the public static int flower; I would like to send the total amount collected with a single call.. could you help me please??

unity3d
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

·
Xiao Zha avatar image
Xiao Zha answered

You can only purchase one item, container, or bundle in one API call use the PurchaseItem API.

If you want to purchase multiple items at once, in economy v1, we will suggest you use the API StartPurchase, PayForPurchase, and ConfirmPurchase to purchase multiple items. Otherwise, you can implement an Azure Function to call the Server API SubtractUserVirtualCurrency and GrantItemsToUser and then pass in a list of items as the parameter for purchase. This method is also suitable for adding multiple items to a player's 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.

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.