question

Jay avatar image
Jay asked

Transfer currency to another playfab account

I want a user to be able to initiate a currency transfer to another user. I was thinking that it would be done from a CloudScript called in the context of the initiating user.

Is this possible and how would it be done?

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

·
brendan avatar image
brendan answered

The most secure way would be to provide a way for the player to purchase a Container that holds the VC, and then put it in a Trade for the other player. You would then need to write to that other player's user data or a shared group data belonging to that user, to let him know about the Trade ID (we'll be providing a generic message system in a future update, as well as discoverability options for trades).

But alternately, yes, you could simply do this in a Cloud Script call, adding the VC to the target player, and subtracting it from the current player. Bear in mind that a) you should check the player's balance to ensure he has as much as he wants to send first, as the subtract call does allow VC to go negative (by design - some titles need that), and that if a player issues several calls to the Cloud Script in question rapidly (a hacker, usually), it's possible that he could manage to go negative anyway, since he could get lucky and have the two calls processing simultaneous (should be rare, but it's technically possible).

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.