question

swapnilnegi avatar image
swapnilnegi asked

Update Currency after a Purchase(Gold Coins)

Hello Team,

I am able to purchase an item "100 Gold Coins" from google play store. After the purchase I update the currency balances using "PlayFabClientAPI.AddUserVirtualCurrency" which I feel is not the right way and it should be done in the server internally after a successful purchase of the item. Is there any way to do that? Thanks for the help!

Player Data
1 comment
10 |1200

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

swapnilnegi avatar image swapnilnegi commented ·

Used server.AddUserVirtualCurrency in the Cloudscript and called the function from client. Problem solved!!

0 Likes 0 ·

1 Answer

·
brendan avatar image
brendan answered

Actually, we wouldn't recommend that either, for most normal cases. To sell virtual currency to a player, you can create a Bundle item in your game's catalog, and add the VC to it. Make sure the Bundle is set to expire after a few seconds, so that after it drops off the currency, it cleans itself up. Then, just sell the player the Bundle.

But yes, we would always recommend leaving the Client API calls for adding virtual currency and setting statistics turned off (the default), to prevent cheating.

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.