Search Unity

  1. Unity 2018.1 has arrived! Read about it here
    Dismiss Notice
  2. Scriptable Render Pipeline improvements, Texture Mipmap Streaming, and more! Check out what we have in store for you in the 2018.2 Beta.
    Dismiss Notice
  3. If you couldn't join the live stream, take a peek at what you missed.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  5. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  6. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  7. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

ArgumentException: Cannot set currency to an empty or null string

Discussion in 'Unity IAP' started by Kiwasi, May 19, 2018.

  1. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    15,047
    I'm getting 'ArgumentException: Cannot set currency to an empty or null string' trying to implement codeless IAP.

    It looks like I've just forgotten to complete a currency somewhere, but I can't seem to find it. Anyone seen this anywhere?

    I'm using Unity 2018.1.0f2 if it matters.

    ArgumentException: Cannot set currency to an empty or null string
    UnityEngine.Analytics.Analytics.Transaction (System.String productId, Decimal amount, System.String currency, System.String receiptPurchaseData, System.String signature, Boolean usingIAPService) (at C:/buildslave/unity/build/Modules/UnityAnalytics/UnityAnalytics.cs:134)
    UnityEngine.Purchasing.UnityAnalytics.Transaction (System.String productId, Decimal price, System.String currency, System.String receipt, System.String signature) (at /Users/stevenb/unity-src3/Extensions/UnityPurchasing/Runtime/Purchasing/UnityAnalytics.cs:14)
    UnityEngine.Purchasing.AnalyticsReporter.OnPurchaseSucceeded (UnityEngine.Purchasing.Product product) (at /Users/stevenb/unity-src3/Extensions/UnityPurchasing/Runtime/Purchasing/AnalyticsReporter.cs:27)
    UnityEngine.Purchasing.StoreListenerProxy.ProcessPurchase (UnityEngine.Purchasing.PurchaseEventArgs e) (at /Users/stevenb/unity-src3/Extensions/UnityPurchasing/Runtime/Purchasing/StoreListenerProxy.cs:33)
    UnityEngine.Purchasing.PurchasingManager.ProcessPurchaseIfNew (UnityEngine.Purchasing.Product product) (at /Users/stevenb/unity-src3/Extensions/UnityPurchasing/Runtime/Purchasing/PurchasingManager.cs:211)
    UnityEngine.Purchasing.PurchasingManager.OnPurchaseSucceeded (System.String id, System.String receipt, System.String transactionId) (at /Users/stevenb/unity-src3/Extensions/UnityPurchasing/Runtime/Purchasing/PurchasingManager.cs:115)
    UnityEngine.Purchasing.JSONStore.OnPurchaseSucceeded (System.String id, System.String receipt, System.String transactionID)
    UnityEngine.Purchasing.FakeStore.<>n__0 (System.String id, System.String receipt, System.String transactionID)
    UnityEngine.Purchasing.FakeStore+<>c__DisplayClass15_0.<FakePurchase>b__0 (Boolean allow, PurchaseFailureReason failureReason)
    UnityEngine.Purchasing.UIFakeStore+<>c__DisplayClass14_0`1[UnityEngine.Purchasing.PurchaseFailureReason].<StartUI>b__0 (Boolean result, Int32 codeValue)
    UnityEngine.Purchasing.UIFakeStore.OkayButtonClicked ()
    UnityEngine.Purchasing.UIFakeStore.<InstantiateDialog>b__16_1 ()
    UnityEngine.Events.InvokableCall.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:166)
    UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:58)
    UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:36)
    UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:45)
    UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:50)
    UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:261)
    UnityEngine.EventSystems.EventSystem:Update()
     
  2. bryukh

    bryukh

    Joined:
    Nov 12, 2016
    Posts:
    1
    The same for me. I got this on the working project after updating to 2018.1.
     
    Kiwasi likes this.
  3. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    957
    Kiwasi likes this.
  4. AlexSikilinda

    AlexSikilinda

    Joined:
    May 8, 2018
    Posts:
    4
    @ap-unity

    When could we expect the future version release?
     
  5. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    15,047
    bryukh likes this.
  6. phpnato

    phpnato

    Joined:
    Aug 16, 2013
    Posts:
    9
    How to fix it?
     
  7. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,614
    @phpnato Unfortunately I'm still seeing the exception in IAP 1.19, so you would need to wait for the next release. Is it preventing the purchase to complete on the device for you?
     
  8. phpnato

    phpnato

    Joined:
    Aug 16, 2013
    Posts:
    9
    Yes. There is an error while purchasing.
     
  9. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,614
    @phpnato Understood, the IAP team is working on it, no ETA yet but I will keep this thread updated.
     
  10. AlexSikilinda

    AlexSikilinda

    Joined:
    May 8, 2018
    Posts:
    4
    As I understand it, the purchase succeeds, and then we get an exception while trying to send this event to Analytics: upload_2018-5-24_15-34-6.png
     
  11. shark812

    shark812

    Joined:
    Dec 6, 2012
    Posts:
    6
    Are those purchase registered or they fail?
     
  12. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    15,047
    I've reverted to 2017.4. Unless you need a new feature, this seems to be the best fix.
     
  13. milamila

    milamila

    Joined:
    Nov 21, 2013
    Posts:
    5
    the same problem with working project. is it possible to solve the problem with 2018.1.f1 or the only way is to go back to old version?
     
  14. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,614
    Please see my post from May 23, we are working on a resolution.
     
  15. milamila

    milamila

    Joined:
    Nov 21, 2013
    Posts:
    5
    Thank you
     
  16. tswierkot

    tswierkot

    Joined:
    Feb 15, 2017
    Posts:
    15
    Almost two weeks later and the bug still isn't fixed. A bug that any decent QA should've been able to catch. Things like this are why my company wants to move to other game engines - Unity just feels like it's in perpetual beta.
     
    thecotanak likes this.
  17. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,614
    The fix is currently going through QA, we want to make sure it properly addresses the issue. Our test matrix with various store platforms, device platforms and Unity versions is quite large, and takes time.
     
  18. thecotanak

    thecotanak

    Joined:
    Sep 2, 2012
    Posts:
    12
    Still no fix for this?
     
  19. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,614
    We are working on this issue at highest priority. I personally ensured yesterday that this is the first issue to be addressed. We are currently scheduling the fix into the release cycle.
     
    thecotanak likes this.
  20. thecotanak

    thecotanak

    Joined:
    Sep 2, 2012
    Posts:
    12
    Thank you.
     
  21. wagenheimer

    wagenheimer

    Joined:
    Jun 1, 2018
    Posts:
    5
    I'm also facing the same problem. @JeffDUnity3D Please post here when the fix is released.
     
  22. nikescar

    nikescar

    Joined:
    Nov 16, 2011
    Posts:
    59
    How can I turn off Analytics so it doesn't try to send out the "null string"? Any work around so we can get back to IAP development?
     
    newwise, thecotanak and jjurica like this.
  23. thecotanak

    thecotanak

    Joined:
    Sep 2, 2012
    Posts:
    12
    This is sad, because we've completed our game and waiting for the release. Can't test IAP, can't publish the game.
     
  24. phpnato

    phpnato

    Joined:
    Aug 16, 2013
    Posts:
    9
    The delay to solve the problem is ridiculous. This problem can cause great financial loss. What is the deadline to solve this?
     
  25. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,614
    The delay is due to the fact that it involves a change to the Editor in addition to the IAP package. We are trying to coordinate and test the required changes, and it's taking longer than expected.
     
  26. newwise

    newwise

    Joined:
    Mar 14, 2016
    Posts:
    6
    We need workaround too. Who know it?
     
  27. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,614
    @newwise A workaround, and as reported by others here, would be to consider using Unity 2017 where the issue should not occur.
     
  28. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    957
    @Kiwasi, @bryukh, @AlexSikilinda, @phpnato, @shark812, @milamila, @tswierkot, @thecotanak, @wagenheimer, @nikescar, @newwise

    We have done some more investigation into this issue and it looks like an error in the FakeStore that we use in the Editor to test Purchasing.

    I have confirmed that this this problem does not occur on devices.

    The FakeStore is meant to simulate the purchasing dialogs that the OS provides. In this case, we mistakenly set the currency to an empty string when using Codeless IAP.

    Workarounds:
    • Use the scripting API instead of Codeless IAP.
    • Use 2017.4 where this issue isn't present.
    • Continue using 2018.1 and Codeless IAP, but test the behavior when the purchase is complete separately from the actual ProcessPurchase call.
    This will be fixed in version 1.20 of Unity IAP.

    I apologize for any inconvenience this has caused.
     
  29. nikescar

    nikescar

    Joined:
    Nov 16, 2011
    Posts:
    59
    ap-unity, Thank you for the info. This will help a lot
     
  30. jamesk5

    jamesk5

    Joined:
    Nov 26, 2012
    Posts:
    5
    @ap-unity thanks for the help.
    1. Asset store says IAP is v1.19, but package manager says 2.0.3. I originally installed IAP via asset store, but since it has shown up as in-project in the package manager I recently updated it from there. But the discrepant version numbers are confusing. Do you have any advice about managing the IAP asset from the store vs. package manager?
    2. Is there an ETA for IAP v1.20 when this bug will be fixed?
    3. I don't quite understand what you mean by "test the behavior when the purchase is complete separately from the actual ProcessPurchase call". Could you provide an example? Are you saying do not add a callback to OnPurchaseComplete in the inspector?
     
    thecotanak likes this.
  31. thecotanak

    thecotanak

    Joined:
    Sep 2, 2012
    Posts:
    12
    Thanks for the reply. I'd like an explanation or example for this one, too.

    Thanks again.
     
  32. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    957
    Yeah, that can be a bit confusing. A little bit of context for this: Unity IAP has always existed in two parts: 1) the part that is integrated into the Unity Engine and 2) the part that is in the Asset Store plugin. The Asset Store plugin contains most of the Store specific code. The split was necessary because the IAP Core could only be upgraded with new versions of the Unity Engine, but we needed more flexibility when it came to interfacing with third party stores.

    With the Package Manager added in 2017/2018, we hope to get the benefit of updating more frequently, while still being closely integrated into the Engine.

    So the Purchasing Package that is available in Package Manager is actually the IAP Core. And the Asset Store plugin is what it has always been. And you will need both of these packages to use Unity IAP. In the future, these two packages will likely be combined. We're still working on the details of that, in order to maintain backwards compatibility.

    It's still early days with the Package Manager, but it holds a lot of promise for this and many other features of the Editor.

    Unfortunately, I don't have an ETA. I'll talk to the IAP team next week and find out if they have an expected release date.

    When you're in the Editor and you only want to test the systems around IAP, then you can simply bypass it. For example, you could do something like this:
    • Disable the IAP Button script
    • Add the relevant callback to the OnClick event of the Button directly
    upload_2018-6-16_14-31-35.png
    Now you can make test what would happen if the purchase was successful (your particle effects, sound effects, logging, inventory changes, etc.)

    Once you have confirmed that all of that works, you can simply remove the callback from the Button's OnClick event listener and re-enable the IAP Button script.

    There are other ways to do this and this is not a perfect solution. But hopefully it helps until this is fully fixed.
     
  33. thecotanak

    thecotanak

    Joined:
    Sep 2, 2012
    Posts:
    12
    Thanks for the detailed reply. But the thing is I'm not trying to see if the after-purchase codes work or not. The IAP button script is not working on the test devices either. It's not an editor only problem. My Google Play Store beta test users can't purchase the IAP, so that's not editor only.

    Thanks for the replies and great work.
     
  34. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    957
    As far as I'm aware, this issue only affects the FakeStore in the Editor.

    If you are getting another error, you should create a new thread and provide the details requested here:
    https://forum.unity.com/threads/read-this-before-you-post.450618/
     
  35. thecotanak

    thecotanak

    Joined:
    Sep 2, 2012
    Posts:
    12
    Actually it's the same error I'm getting:
    ArgumentException: Cannot set currency to an empty or null string

    So I'll continue following this thread.
     
  36. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    1,614
  37. thecotanak

    thecotanak

    Joined:
    Sep 2, 2012
    Posts:
    12
    @JeffDUnity3D Sorry, it turns out that's our mistake.

    We've tested on Play Store closed alpha and after correcting the license test emails, it worked fine on device.

    Thanks.