question

warren avatar image
warren asked

How can I get display name of a virtual currency?,Can't find how to find virtual currency's display name

I'm brand new to PlayFab so I feel like I'm missing something simple.

I've got several virtual currencies defined for my title. I cannot figure out how to get the display name of a currency through the PlayFabClientAPI.

Furthermore, is there a way to get all currencies defined in the title, or must I assume they exist and hard-code them into the game?

,

I'm brand new to Playfab, so I feel like I'm missing something simple.

I've defined a few virtual currencies and given them display names. However, I cannot figure out how to ask the PlayFabClientAPI for data about the currency, not just how much of each currency my players and characters have.

Furthermore is there an API call that will return all defined currencies in the title? Or must I live with hard-coded currency code strings in my game?

unity3ddata
1 comment
10 |1200

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

warren avatar image warren commented ·

Sorry for the weird double-post. I thought my question got cleared after pressing the "Login and Post" button, but I guess not.

0 Likes 0 ·

1 Answer

·
Justin avatar image
Justin answered

Goto "https://developer.playfab.com/en-US/"YOUR_TITLE_ID"/economy/currency" to configure your currency in PlayFab manually (or json upload here works too).

Then, in the client call "PlayFabClientAPI.GetUserInventory" https://api.playfab.com/documentation/client/method/GetUserInventory

Is that what you were looking for?


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

warren avatar image warren commented ·

@Justin Thanks for the reply. This is not exactly what I was looking for.

I'm wondering if there's a way I can "discover" currencies I've defined in data without having to do a comparison with hard-coded strings (the eachPair.key == "GB" in your example). I suppose if the virtualCurrency dictionary returned by PlayFab always has a key for all currencies even if the player owns 0, then that tells me the complete set of currencies defined in the title.

However, what do I do with "GB" currency code if I wanted to know its display name?

0 Likes 0 ·
Justin avatar image Justin commented ·

It does not look like GetUserInventory() allows passing the display name.. strange.. I didn't notice that. I am only using one Virtual Currency and Real Money. However, I can see how having a list of Currency Display Names could be handy, especially if you could build a return with Currency Display Names attached to the KeyValue Pairs after they were retrieved. You may have to manually convert the Currency code inside your money handling script as a global name conversion.

Maybe I missed something. Hopefully others will check this out.

0 Likes 0 ·
brendan avatar image brendan commented ·

Currencies aren't something that change on the fly - they're pre-defined for the title. So the presumption is that the title will have the info on the currencies. But that said, the details are returned in the inventory call, if the player has the currency, and there's an Admin API call to query all existing currencies for the title, if you're building local tools for your team to use.

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.