Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by Ivan_Ivan · Jun 20 at 03:02 AM · Player Datagame managerIn-Game EconomyPlayer Inventory

Referral system by code in the game.

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!

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image

Answer by Xiao Zha · Jun 20 at 09:39 AM

According to your description, the referral system can be implement with UGC.

>> 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.

When the player first enter the game, you can create a UGC Item with a unique code, then store the code in player data which you can achieve with Get User Data API.

>> 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.

When someone use the code, you can search the UGC items to find out if the code exists, then use cloudscript to grant 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.

When a player uses a code, you can record the code in that player’s player data, and next time you use a code, you can check the code in player data to confirm whether the code has been used by the current player.

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    1 Person is following this question.

    avatar image

    Related Questions

    How would I handle a virtual currency online and offline?,Some questions about integration with PlayFab. 1 Answer

    I am using Photon pun2 for creating multiplayer game, and also I am using playfab services for Inventory, catalogue etc. Is it possible to finish the game without integrating? 1 Answer

    How do I define players who has some set of attributes and can be added to a squad? 1 Answer

    Server Side Virtual Currency (To avoid currency hackers) 1 Answer

    Best way to reset all players' data? 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges