question

Tikhon Rulkevich avatar image
Tikhon Rulkevich asked

Is there any way to add item to the player's inventory via code without purchasing it (for free)

Is it possible to add to the inventory an item which was find somewhere without wasting Virtual Currency (because player just found this item, there is no reason to pay for it)

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

If you are using Economy V1, you can implement an Azure Function to call server API Player Item Management - Grant Items To User - REST API (PlayFab Server) | Microsoft Docs to add item to the player’s inventory. If you are using Economy V2, you can call API Inventory - Add Inventory Items - REST API (PlayFab Economy) | Microsoft Docs.

2 comments
10 |1200

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

Tikhon Rulkevich avatar image Tikhon Rulkevich commented ·

Hello, Thank you it might be the solution. But do you have maybe an example of the Grant Items To User function in cloud script? Because i cant find any examples as well as to which class this method belongs to call it in cloud script. Thank you in advance.

0 Likes 0 ·
Gosen Gao avatar image Gosen Gao Tikhon Rulkevich commented ·

You can refer to:

server.GrantItemsToUser({PlayFabId:currentPlayerId,ItemIds:["item_bundle_1"]});
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.