Own PlayFab login, "Couldn't get funds, no currency specified" error



  • Hi,
    I followed the setup instructions for full playfab integration. IAP settings have been completed, Identifiers are correct and shop manager has been added to the scene but I receive the following error messages when i attempt to make a purchase:

    1. Product not found in IAP Settings.
      UnityEngine.Debug:LogError(Object)
      SIS.IAPManager:PurchaseProduct(String) (at Assets/SimpleIAPSystem/Scripts/IAPManager.cs:367)
      SIS.IAPItem:Purchase() (at Assets/SimpleIAPSystem/Scripts/IAPItem.cs:258)
      UnityEngine.EventSystems.EventSystem:Update() (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/EventSystem.cs:377)

    2. Couldn't get funds, no currency specified.
      UnityEngine.Debug:LogError(Object)
      SIS.DBManager:GetFunds(String) (at Assets/SimpleIAPSystem/Scripts/DBManager.cs:457)
      SIS.PlayfabStore:Purchase(IAPObject) (at Assets/SimpleIAPSystem/Scripts/Extensions/PlayFab/PlayfabStore.cs:159)
      SIS.IAPManager:PurchaseProduct(IAPObject) (at Assets/SimpleIAPSystem/Scripts/IAPManager.cs:408)
      SIS.IAPManager:PurchaseProduct(String) (at Assets/SimpleIAPSystem/Scripts/IAPManager.cs:374)
      SIS.IAPItem:Purchase() (at Assets/SimpleIAPSystem/Scripts/IAPItem.cs:258)
      UnityEngine.EventSystems.EventSystem:Update() (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/EventSystem.cs:377)

    How do fix this issue?

    Thanks



  • Ignore error message number 1, I was references the wrong IAP item on the button. So, just error message number 2 left.

    Thanks



    1. I guess you have placed IAPItem instances manually into your scene. If you make use of our ShopManager, and assign a prefab to your group in the IAP Settings editor, you would not need to enter product identifiers on the IAPItems at all - since they are then instantiated automatically with their product identifiers in place (see example scenes).

    2. Simple IAP System requires a few player properties from PlayFab in order to work correctly, such as the user's inventory and currency amount. If you are logging in players with your own login method, you could be missing those values. In the login request to PlayFab, you need to explicitly tell PlayFab to return these player properties to your app.

    For example, your custom login method could look like this (actually taken from your project):

    public void Login(string username, string password)
    {
          PlayFabClientAPI.LoginWithPlayFab(new LoginWithPlayFabRequest() { TitleId = PlayFabSettings.TitleId, Username = username, Password = password, InfoRequestParameters = new GetPlayerCombinedInfoRequestParams() { GetPlayerProfile = true } }, OnLoginSuccess, OnLoginFailure);
    }
    

    GetPlayerCombinedInfoRequestParams defines the data you would like to receive from PlayFab. Currently, only the PlayerProfile is being requested as additional data. However, Simple IAP System needs the following additional player properties: UserInventory, UserVirtualCurrency, UserData (with specific data keys). You can also see them in our PlayfabManager script, where they are defined in the Awake() method. With those added, the login method above would look like this:

    public void Login(string username, string password)
    {
          PlayFabClientAPI.LoginWithPlayFab(new LoginWithPlayFabRequest() { TitleId = PlayFabSettings.TitleId, Username = username, Password = password, InfoRequestParameters = new GetPlayerCombinedInfoRequestParams() { GetPlayerProfile = true, GetUserInventory = true, GetUserVirtualCurrency = true, GetUserData = true, UserDataKeys = new List<string>() { SIS.DBManager.playerKey, SIS.DBManager.selectedKey } } }, OnLoginSuccess, OnLoginFailure);
    }
    

    After logging in and calling our PlayfabManager.OnLoggedIn method with the LoginResult, Simple IAP System should be able to get the user inventory and currency, since they are now returned by PlayFab, so the error will be gone.



  • Thank you for your help, it worked and the error message has gone. However purchases are not appearing on playfab and virtual coins are not added to inventory.
    Are there additional lines of code that I need to change?



  • It is impossible for me to guess what's wrong with your app/code. You will need to make a deeper investigation to find out what (method or call) exactly does not work and provide error logs.



  • There are actually no error logs. After the IAP buttons are pressed nothing happens. I have playfab playstream open and no payments are received.



  • When buying virtual currency products for real money with PlayFab in the Unity editor, you should see the following behavior:

    • coins are added to the player's balance on purchase, locally (you can verify this with the IAPListener.HandleSuccessfulPurchase method)
    • coins are not added to the player on PlayFab, nor does the payment show up under the "Purchases" tab

    This is because there is no payment in the Unity editor. We cannot send a payment that does not exist to PlayFab, so there is nothing to validate or add on the PlayFab backend. You need to test on a real device, with a test account, initiating a real test purchase (displaying and confirming the App Store purchase popup).



  • Thank you I really appreciate your assistance. I will test on a real device.



  • It worked on both devices. Thank you


Log in to reply