We are planning to create a referral system that incentivizes our players to tell their friends and bring new players into the game. This questions is about how to ideally track the data in PlayFab and how to reward both the new player and the referrer.
Let's imagine that the referrer generates a referral link, then sends it to a friend, who then downloads our game. Upon the first startup the new player's client knows that a player with the PlayFabID A invited them.
Now the new player has to tell PlayFab that they want to use their one-time I-was-referred-by option and therefore the new player is getting rewards. So far it's easy. But we also need to have the referrer get their rewards and have them know that they did refer somebody. The initial idea would be that the new player writes their PlayFabID somewhere into the referrer's player data.
So far we could avoid that any player has to write into another player's data since we know that this might lead to race conditions / multiple players writing into the same data and something getting lost.
Is there some way of locking while writing data to a certain player data key? I've read quite a while ago that it was planned. Alternatively is there a better way to do it that maybe does not even raise this issue?
Looking forward to what you think! ;)