Search code examples
unity-game-enginein-app-purchasecurrency

Unity API to convert in-game currency to real money and give to player


I have an unity mobile game where players can earn in-game currency from other players and I want them to be able to exchange that currency for real money. Currently we wanted to use Playfab for that but I can't find any option to convert the currency. The system should do the followings:

  • allow players to purchase currency with real money
  • allow players to shop items via that currency
  • allow players to give currency to other players (earn it from other players)
  • allow players to exchange any amount of owned currency back to real money via google play or app store (if it is possible to use them)

If Playfab can't do that is there any other service or API that would allow us to implement this? Thank you in advance


Solution

  • I will start off by saying this is a very broad question and there are numerous solutions to such a problem.

    One potential solution to the first issue could simple be to use a gateway such as Paymentwall, Xsolla, Stripe, PayPal this could have a web hook to PlayFab which passes userID, currency and then updates the user account accordingly.

    https://api.playfab.com/docs/tutorials/landing-analytics/webhooks

    As for creating a shop, again there a load of ways going about it however since PlayFab does have a system for such an issue, you could potentially try it out:

    https://api.playfab.com/docs/tutorials/landing-commerce/stores

    Again, since you are using Playfab I suggest you take a look at cloud script, sending currency could be achieved with it.

    https://api.playfab.com/docs/tutorials/landing-automation/using-cloud-script

    For sending out payments I will not debate the logistics of such a system however PayPal does have a Payout API which I am sure could be used to facilitate such a system.

    https://developer.paypal.com/docs/api/payments.payouts-batch/v1/