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 warren · Nov 29, 2018 at 09:51 PM · unity3ddata

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?

Comment

People who like this

0 Show 1
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
avatar image warren · Nov 29, 2018 at 08:57 PM 0
Share

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

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Justin · Nov 29, 2018 at 11:15 PM

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?


devenv-2018-11-29-14-32-38.png (39.7 kB)
Comment

People who like this

0 Show 3 · 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
avatar image warren · Nov 30, 2018 at 02:09 AM 0
Share

@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?

avatar image Justin · Nov 30, 2018 at 07:48 AM 0
Share

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.

avatar image Brendan ♦♦ · Nov 30, 2018 at 08:06 AM 0
Share

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.

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

    3 People are following this question.

    avatar image avatar image avatar image

    Related Questions

    Question: Reading data from player account 1 Answer

    Entity Files, Load User Profile Picture 2 Answers

    PlayFabServerAPI.GetUserData returning 500 internal error, is playfab down ? 1 Answer

    How to send List to cloud script? Not a Map,How to send a list of objects using ExcuteCloudScript? (not a dictionary) 1 Answer

    Update part of a JSON 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