I am yet to implement IAP for my project but want to know if the bundles will automatically be granted by playfab on successful IAP purchase?
If yes then where do we have to specify which bundles has to be granted to that player on success?
Also I want to do some custom granting of rewards based on the bundle that is been granted. The custom rewards will be defined in the same bundle's custom data.
So how can I trigger a cloudscript function and I would need the data of which bundle was granted(from that trigger) so that I can look into that item's custom data specifically and do custom operations
Answer by Citrus Yan · Apr 30, 2020 at 09:27 AM
>> …bundles will automatically be granted by playfab on successful IAP purchase?
Yes, bundles will automatically be granted by PlayFab on successful IAP purchases, please navigate to this tutorial to learn more: https://docs.microsoft.com/en-us/gaming/playfab/features/commerce/economy/getting-started-with-unity-iap-android#setting-up-a-playmarket-application-for-iap
>> If yes then where do we have to specify which bundles has to be granted to that player on success?
I don’t follow, that specific bundle(s) player bought will be added to the inventory, and, in normal cases, we usually make the bundle consumable by time (few seconds) so that it goes away after “dropping off” its contents soon after granting.
>> So how can I trigger a cloudscript function and I would need the data of which bundle was granted(from that trigger) so that I can look into that item's custom data specifically and do custom operations
You can set a up Rule that acts on the player_inventory_item_added event, use Conditions to find the specific bundles you want to perform custom operations on, and trigger a Cloud Script to do the work, the data from the event that triggered the action can be accessed using context.playStreamEvent in the handler function.
- Can I use com.playfab.player_receipt_validation instead of player_inventory_item_added event?
- Using the conditions I can trigger a cloudscript. But I will be executing the same cloudscript for every IAP purchase and as you said is this bundle Id accessible from context.playStreamEvent?
1. Probably not: player_receipt_validation event does not contain necessary info for you to find events regarding to bundles. You may use custom event for this.
2. Yes, Bundle Id should be the Item Id : https://docs.microsoft.com/en-us/gaming/playfab/api-references/events/player-inventory-item-added
As of November 2018 what is the recommended IAP Asset? 1 Answer
problem with PurchaseItemRequest 1 Answer
Summary of inventory items owned 1 Answer
Consumable Game Items 1 Answer
What is the best way to model nothing in a drop table? 1 Answer