question

Thomas Brown avatar image
Thomas Brown asked

ValidateGooglePlayPurchase straight to Character inventory instead of User inventory.

I am moving my inventory from a User inventory system to a character inventory system. So far everything has been working well, however the main issue that i'm running in to is how to handle receipt validation.

ValidateGooglePlayPurchase automatically grants the appropriate item to the user inventory when receipt is validated. The main issue there is that I will then need to move the item over to the character inventory myself, as there doesn't seem to be a way to specify doing this in the request.

I'm curious how I might automatically set the character inventory as the destination inventory for the validated purchase. Is there any way to do this? If not, what is the recommended way to handle this scenario?

My main gripe is that because it's not automated, I will now have to check both the user inventory and the character inventory for a characters items. I'm also not sure how to distinguish one characters items from one another in the user inventory given this system.

Thanks for any help in advance!

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

·
Neils Shi avatar image
Neils Shi answered

As our document mentioned that “Once verified, the catalog item (ItemId) matching the GooglePlay store item (productId) will be added to the user's inventory”. Since currently there is no way to set the character inventory as the destination inventory for the validated purchase, you should call API MoveItemToCharacterFromUser to move the item from user's inventory into their character's inventory after verifying.

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.

Thomas Brown avatar image Thomas Brown commented ·

Just to clarify, this looks like we can be put in a position where a player receives the item in the user inventory but not in the character inventory (validate call goes through but move call does not).

Originally I was thinking of just combining ValidateGooglePlayPurchase and MoveItemToCharacterFromUser into a azure cloud function however it looks like the ValidateGooglePlayPurchase is only available in the client side api.

Would it be a bad idea to use the PlayFabClientAPI server side in this case to get things working as I was hoping?

0 Likes 0 ·
Neils Shi avatar image Neils Shi Thomas Brown commented ·

In your scenario, you can validate the receipt on the client first, then use Azure Function to move items to character inventory. If the move fails, clients can simply call the Azure Function again.

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.