Hello, I am working on a multiplayer game with mirror and ugs.
I am developing a shop and I need the server to obtain all the possible products for the player (virtual economy purchases) through cloud code.
This is possible? Because the only thing I find is being able to access the player’s inventory but not the products available for purchase.
can cloud code connect with economy and obtain virtual purchasing?
Hi!
I’m from the dev experience team, let me try to help you out here.
Are you using C# or JS?
Each service has 2 APIs, the runtime API that is used by clients, and the admin API that is used by the dashboard, editor, etc, for configuring the services.
Will raise that question up with the team, looking at the APIs documentation looks like the Economy Client API does not have than info, the admin API does: Unity Services Web API docs. You’ll need a service account that can be set up from the dashboard.
I see 4 options:
- Call that endpoint from your Cloud Code using service account. Use Caching if possible as the rate limits on admin APIs are way stricter.
- I describe here how to generate a client from specs . You can generate one for the admin API instead of the runtime API.
options 1 and 2 are slightly technical and need a lil work, but the CLI has code that shows how its used.
- Hardcode your purchases into your Cloud Code Script. I know this is not ideal, but might be good enough in the short term.
- Wait for a feature update from the team.
If you’re using Cloud Code Modules, option 1 or 2 with caching is probably the best bet.
Ill see what the service teams think 
Cheers!
Hello, the Economy cloud code module should allow you to get all available purchases for the player.
All resources, including possible purchases, are returned from the getPlayerConfiguration endpoint.
Just pass the playerID along to your cloud code script.
The PlayerID is needed because you might have Game overrides on the purchase rewards which would change what is returned for that player.
Great thanks, I was able to access all the information I needed through the getPlayerConfiguration.