First, I am very new to network code. However, we have multiplayer working through Photon so I've learned quite a bit.
We will have a virtual currency, purchased through App Store or Google Play. So I am wondering about Best Practices when coding these purchases.
We do not have dedicated servers so we will have to use the client API. I am thinking that the purchase flow could go like this: the player makes a currency purchase through the appropriate store, this purchase is then saved to the players PlayFab account and to a local variable. The local variable would be for quick reference only, for displaying to the UI and such.
And then when a player spends their Currency the code makes a call to PlayFab to check if the player has enough of the Currency. If so the transaction is allowed and the local variable and the PlayFab account is updated. If not, then the local variable is updated if it is different.
Normally, players should not have to or even be allowed to spend their currency very often. However, we could add code that prevents players from spending their currency in rapid succession to deter to many PlayFab server calls.
So the question is...is this a good way to set this up? What are the alternatives?
And how could players misuse this system?