Hello! In my game, I want to make something like a referral system: assign each player a personal code, and every time someone uses someone else's code, the owner of the code will receive coins.
Can I do it with Playfab tools?
Let's assume the following algorithm of actions:
1) I give out a personal code to each player when they first enter the game: I need to make a request to the Playfab database from the client side to get a list of all codes to avoid a match when generating a new code. Then send the new code of the new player to his profile on Playfab.
2) When someone uses someone else's code, I have to go back to the Playfab database to find out if such a code exists and if so, to which player it belongs. After that, I need to issue the required amount of coins to the owner of the code.
3) At the same time, I need to block the players from using any codes several times - each player can use someone's code only once and get coins for it. But others can use the player's code an unlimited number of times and for each use he will receive coins.
Please tell me, did I present the algorithm of actions correctly? Tell me, what tools can I implement this? In particular, how can I search through the codes of all players or are there any other Playfab tools to make my task easier?
I hope for your answer.
Thank you!