Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

I can make IAP work in my game. Failure Reason: Unknown

Discussion in 'Unity IAP' started by jdgauchat, Oct 8, 2018.

  1. jdgauchat

    jdgauchat

    Joined:
    Jun 24, 2017
    Posts:
    18
    Hi, guys. It's been more than 10 hours since I came up with this issue and my eyes are burning, so I better ask for help.

    This is an unpublished iOS game.

    The game compiles and loads fine on my iPhone, but every time I try to purchase a product (consumable or not consumable) I get the error
    PurchaseFailureReason: Unknown

    The session is initialized, the product is recognized, I even get the value of the product from iTunesConnect, but the OnPurchaseFailed function is called every time.

    I tried with my game and also with an empty project I created to try to solve this issue with different items (consumable and non-consumable), and I always get the same error.

    I use the sample code found here (adapted to my game and as-is for the testing app)
    https://unity3d.com/learn/tutorials/topics/ads-analytics/integrating-unity-iap-your-game

    There were several issues I had to go through to install IAP in Unity, which makes me think that the problem is a bug:

    - First, I get the error "The IAP service is currently disabled" when I try to import the IAP plugin from the Services tab. I solved this issue by installing the package from the Package Manager. But I had to install the package, then go back to the Services tab, press Import again and then I got the popup window with the list of assets to import.
    - If I try to install the IAP plugin from the Asset Store, I get the same error "The IAP service is currently disabled".
    - In Xcode, the InApp Purchase service in the Capabilities panel is always deactivated. When I saw this, I thought that this was the problem, but I turned the switch on and keep getting the "unknown" error.
    - I tried with the testers accounts I created in iTunesConnect and also with my real account, and always get the "unknown" error.

    The following is the log of the project I created for testing. It is trying to purchase a consumable. You will notice that the price set for the AppStore is printed in the log (preceded by hyphens), which means that the product is valid and the app can read its price, but the purchase fails anyway.

    Any help will be highly appreciated.

    Note: I read that the 1.21 version is buggy and I should install the 1.20 version, but I have no idea how to do that. When I go to the Package Manager, the versions shown are 2.00, 2.01 and 2.03. Also, if I try to install the version from the Asset Store I get the error mentioned before.

    Code (CSharp):
    1. 2018-10-08 17:04:23.053101-0400 testiap[1930:465324] [DYMTLInitPlatform] platform initialization successful
    2. 2018-10-08 17:04:23.073058-0400 testiap[1930:465264] UnityIAP UnityEarlyTransactionObserver: Created
    3. 2018-10-08 17:04:23.074008-0400 testiap[1930:465264] UnityIAP UnityEarlyTransactionObserver: Registered for lifecycle events
    4. 2018-10-08 17:04:23.110632-0400 testiap[1930:465264] Built from '2018.2/release' branch, Version '2018.2.11f1 (38bd7dec5000)', Build type 'Release', Scripting Backend 'il2cpp'
    5. 2018-10-08 17:04:23.115612-0400 testiap[1930:465264] -> registered mono modules 0x1032dbb90
    6. -> applicationDidFinishLaunching()
    7. 2018-10-08 17:04:23.211409-0400 testiap[1930:465264] Metal GPU Frame Capture Enabled
    8. 2018-10-08 17:04:23.211857-0400 testiap[1930:465264] Metal API Validation Disabled
    9. 2018-10-08 17:04:23.340416-0400 testiap[1930:465264] [Warning] Trying to set delaysTouchesBegan to NO on a system gate gesture recognizer - this is unsupported and will have undesired side effects
    10. 2018-10-08 17:04:23.340525-0400 testiap[1930:465264] UnityIAP UnityEarlyTransactionObserver: Added to the payment queue
    11. -> applicationDidBecomeActive()
    12. GfxDevice: creating device client; threaded=1
    13. Initializing Metal device caps: Apple A9 GPU
    14. Initialize engine version: 2018.2.11f1 (38bd7dec5000)
    15. UnloadTime: 1.537250 ms
    16. UnityIAP Version: 1.21
    17. UnityEngine.Purchasing.StandardPurchasingModule:Instance(AppStore)
    18. IAPController:InitializePurchasing()
    19. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    20.  
    21. Using configuration builder objects
    22. UnityEngine.Purchasing.StoreCatalogImpl:handleCachedCatalog(Action`1)
    23. UnityEngine.Purchasing.<Process>d__4:MoveNext()
    24. UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
    25. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    26.  
    27. 2018-10-08 17:04:26.888248-0400 testiap[1930:465264] UnityIAP: Requesting 3 products
    28. 2018-10-08 17:04:26.889858-0400 testiap[1930:465264] UnityIAP: Requesting product data...
    29. 2018-10-08 17:04:27.955846-0400 testiap[1930:465264] UnityIAP: Received 2 products
    30. 2018-10-08 17:04:27.958674-0400 testiap[1930:465264] UnityIAP: No App Receipt found
    31. 2018-10-08 17:04:27.984345-0400 testiap[1930:465264] UnityIAP: No App Receipt found
    32. Unavailable product subscription -com.unity3d.subscription.new
    33. UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    34. UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    35. UnityEngine.Purchasing.AppleStoreImpl:OnProductsRetrieved(String)
    36. UnityEngine.Purchasing.Extension.UnityUtil:Update()
    37. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    38.  
    39. OnInitialized: PASS
    40. IAPController:OnInitialized(IStoreController, IExtensionProvider)
    41. UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
    42. UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
    43. UnityEngine.Purchasing.AppleStoreImpl:OnProductsRetrieved(String)
    44. UnityEngine.Purchasing.Extension.UnityUtil:Update()
    45. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    46.  
    47. UnityIAP: Promo interface is available for 2 items
    48. UnityEngine.Purchasing.Promo:ProvideProductsToAds(HashSet`1)
    49. UnityEngine.Purchasing.AppleStoreImpl:OnProductsRetrieved(String)
    50. UnityEngine.Purchasing.Extension.UnityUtil:Update()
    51. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    52.  
    53. 2018-10-08 17:04:27.987446-0400 testiap[1930:465264] UnityIAP: Add transaction observer
    54. 2018-10-08 17:04:27.987543-0400 testiap[1930:465264] UnityIAP UnityEarlyTransactionObserver: Request to initiate queued payments
    55. ---------- Product Value: CAD 2.79
    56. IAPController:BuyProductID(String)
    57. UnityEngine.Events.UnityEvent:Invoke()
    58. UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
    59. UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
    60. UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
    61. UnityEngine.EventSystems.StandaloneInputModule:Process()
    62. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    63.  
    64. Purchasing product asychronously: 'ca.xxx.consumable'
    65. IAPController:BuyProductID(String)
    66. UnityEngine.Events.UnityEvent:Invoke()
    67. UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
    68. UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
    69. UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
    70. UnityEngine.EventSystems.StandaloneInputModule:Process()
    71. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    72.  
    73. 2018-10-08 17:04:43.320835-0400 testiap[1930:465264] UnityIAP: PurchaseProduct: ca.xxx.consumable
    74. 2018-10-08 17:04:43.330539-0400 testiap[1930:465264] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
    75. 2018-10-08 17:04:43.331790-0400 testiap[1930:465264] [MC] Reading from public effective user settings.
    76. purchase({0}): ca.xxx.consumable
    77. IAPController:BuyProductID(String)
    78. UnityEngine.Events.UnityEvent:Invoke()
    79. UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
    80. UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
    81. UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
    82. UnityEngine.EventSystems.StandaloneInputModule:Process()
    83. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    84.  
    85. 2018-10-08 17:04:43.346578-0400 testiap[1930:465264] UnityIAP: UpdatedTransactions
    86. -> applicationWillResignActive()
    87. -> applicationDidBecomeActive()
    88. 2018-10-08 17:05:13.987389-0400 testiap[1930:465264] UnityIAP: UpdatedTransactions
    89. 2018-10-08 17:05:13.987507-0400 testiap[1930:465264] UnityIAP: PurchaseFailed: 0
    90. onPurchaseFailedEvent({0}): ca.xxx.consumable
    91. UnityEngine.Purchasing.PurchasingManager:OnPurchaseFailed(PurchaseFailureDescription)
    92. UnityEngine.Purchasing.JSONStore:OnPurchaseFailed(PurchaseFailureDescription, String)
    93. UnityEngine.Purchasing.Extension.UnityUtil:Update()
    94. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    95.  
    96. OnPurchaseFailed: FAIL. Product: 'ca.xxx.consumable', PurchaseFailureReason: Unknown
    97. IAPController:OnPurchaseFailed(Product, PurchaseFailureReason)
    98. UnityEngine.Purchasing.JSONStore:OnPurchaseFailed(PurchaseFailureDescription, String)
    99. UnityEngine.Purchasing.Extension.UnityUtil:Update()
    100. (Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
    101.  
    102. -> applicationWillResignActive()
    103. -> applicationDidEnterBackground()
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Make sure you have filled out the Business and Tax Info on iTunes, even if you're testing! It is required.
     
  3. jdgauchat

    jdgauchat

    Joined:
    Jun 24, 2017
    Posts:
    18
    Hi, Jeff. Thanks, but it seems to be something else. I'm really getting desperate because the game is finished and I can't get IAP to work.

    Here are the steps I took:

    - The bank account was correct and working since years ago, but Apple was showing me an error asking to complete the information. So I did that, but I was still getting the Unknown error. I waited two days in case the data had to propagate, but I kept getting the error. Also my taxes were fine, but I had completed the taxes for the US and not for Canada (I live in Canada), so I completed that as well, just in case, but after more than two days I'm still getting the error.
    - I decided to use the Codeless API in case there was an error in my code, but after I implemented the button, I got the Unknown error again.
    - I uninstalled and Imported the API again (as described here https://forum.unity.com/threads/iap-troubleshooting-remove-and-reinstall-unity-iap.511747/), but the error keeps showing (this time I didn't have any problem importing the API).
    - I tried with my personal account in case the tester accounts didn't work. I did it in another device where I'm signed in with my Apple ID, but I got the Unknown error every time.

    The only thing that changed after implementing the Codeless API is the error message. Now, instead of showing the product ID, it shows a Unity variable.

    Code (CSharp):
    1. IAPButton.OnPurchaseFailed(Product UnityEngine.Purchasing.Product, PurchaseFailureReason Unknown)
    2. UnityEngine.Purchasing.IAPButton:OnPurchaseFailed(Product, PurchaseFailureReason)
    3. UnityEngine.Purchasing.CodelessIAPStoreListener:OnPurchaseFailed(Product, PurchaseFailureReason)
    4. UnityEngine.Purchasing.JSONStore:OnPurchaseFailed(PurchaseFailureDescription, String)
    5. UnityEngine.Purchasing.Extension.UnityUtil:Update()
    Here is some info about my account.

    - I'm testing this on an iPhone. I signed off before testing the app, as explained in the instructions.
    - I have a second account in iTunes Connect to publish my ebooks (but I access both accounts with the same Apple ID)
    - My user in iTunes Connect has the Admin and Legal roles (it's only me, nobody else has access to it)
    - The game was not published. Do I have to upload a build?
    - The non-consumable product in iTunes shows the message "Ready to Submit"
    - I haven't completed the Version Information for the app ( this is the description and images), but the basic information was already specified (name, subtitle, privacy policy, etc)
    - in Xcode, the IAP service is always deactivated. But no matter if I activate it or not, nothing changes.
    - I didn't do anything in the Unity's website. Do I have to enable something in Unity?
    - I still have Unity's free account (this is my first game). I was thinking of getting the Plus account before publishing. Do you think it would be better to get the account right now to get more personal assistance?

    I'm afraid I'm doing something wrong, but I checked the project and your tutorials over and over and over again, and I couldn't find anything wrong. Maybe I have to wait longer for Apple to finish processing the info, but it's been more than two days already and everything looks fine on iTunes.

    Thanks
    JD
     
    Last edited: Oct 12, 2018
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  5. jdgauchat

    jdgauchat

    Joined:
    Jun 24, 2017
    Posts:
    18
    Hi, Jeff. I compiled that sample app and use it with my testers accounts. The three tester accounts failed with an Unknown error again. So I decided to try creating a new tester account, and with that new account, I was finally able to finish the purchase. The only difference with the previous tester accounts is that this time I followed an advice I found on StackOverflow and verified the account from an Incognito window. I have no idea why the previous accounts didn't work. I hope I won't find this problem in the final testing.

    Thank you so much for your help.

    JD
     
    Last edited: Oct 15, 2018