question

Deekshith avatar image
Deekshith asked

Granting Bundles after IAP purchase

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

In-Game EconomyPlayer InventoryPlayStream
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

·
Citrus Yan avatar image
Citrus Yan answered

>> …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.

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.

Deekshith avatar image Deekshith commented ·

- 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?

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Deekshith commented ·

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

1 Like 1 ·

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.