question

Daniel Frost avatar image
Daniel Frost asked

Securely adding currency using external servers.

Hi, I am using mirror as my entire server system in Unity with Playfab for inventory management. Because of this I am having some problems adding currency to users without enabling client side management and I really don't want that due to the security problems. Is there any easy option to add currency to a Playfab user through my external servers?

Custom Game Servers
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

Yes, the Server API AddUserVirtualCurrency allows you to add currency to players using external servers. And the server API can’t be accessed by players. You can use it to add currency to players securely without allowing clients to add currency.

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Daniel Frost avatar image Daniel Frost commented ·

What I am asking is how you implement it on non-playfab run servers. If I am using an eternal server host how do I tell my server it is a playfab server. Am I able to simply run server commands on external servers but need to pass players id's to the server? I am mostly wondering if there is any external server documentation left. I am using mirror with an aws server so the servers are not using the playfab server commands by default.

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Daniel Frost commented ·

For the clarification, PlayFab Server API is the REST API that can be called anywhere using Http requests. It can be used entirely in the server that hosted in AWS.

Besides, currently, you can only use PlayFab API to modify the data (Player Data, Inventory, etc.) stored in PlayFab, even in the external servers. As the above comment said, you can also call Server API methods in CloudScript and AzureFunction. But the methods other than API are not supported.

1 Like 1 ·
Sarah Zhang avatar image Sarah Zhang Sarah Zhang commented ·

>> If I am using an eternal server host how do I tell my server it is a playfab server?

PlayFab developer secret keys allow you make PlayFab Admin and Server API calls. You just need to add the developer secret keys to your server, the server would be able to call the PlayFab Server API.

You can import PlayFab Unity SDK to your server, navigate to [PlayFab Extension]->[Settings]->[API], then check the [ENABLE SERVER API] to add the secret key to your server.

0 Likes 0 ·
madmojoman avatar image madmojoman Daniel Frost commented ·

If you're not installing the PlayFab SDK on your server, so you could have use of the PlayFab Server API directly...you could probably setup CloudScript and have your server send in a request to PlayFab to run the CloudScript. Then your CloudScript could do the verification with PlayFab for increasing the currency.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.