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)
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.
2018-10-08 17:04:23.053101-0400 testiap[1930:465324] [DYMTLInitPlatform] platform initialization successful
2018-10-08 17:04:23.073058-0400 testiap[1930:465264] UnityIAP UnityEarlyTransactionObserver: Created
2018-10-08 17:04:23.074008-0400 testiap[1930:465264] UnityIAP UnityEarlyTransactionObserver: Registered for lifecycle events
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'
2018-10-08 17:04:23.115612-0400 testiap[1930:465264] -> registered mono modules 0x1032dbb90
-> applicationDidFinishLaunching()
2018-10-08 17:04:23.211409-0400 testiap[1930:465264] Metal GPU Frame Capture Enabled
2018-10-08 17:04:23.211857-0400 testiap[1930:465264] Metal API Validation Disabled
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
2018-10-08 17:04:23.340525-0400 testiap[1930:465264] UnityIAP UnityEarlyTransactionObserver: Added to the payment queue
-> applicationDidBecomeActive()
GfxDevice: creating device client; threaded=1
Initializing Metal device caps: Apple A9 GPU
Initialize engine version: 2018.2.11f1 (38bd7dec5000)
UnloadTime: 1.537250 ms
UnityIAP Version: 1.21
UnityEngine.Purchasing.StandardPurchasingModule:Instance(AppStore)
IAPController:InitializePurchasing()
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
Using configuration builder objects
UnityEngine.Purchasing.StoreCatalogImpl:handleCachedCatalog(Action`1)
UnityEngine.Purchasing.<Process>d__4:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
2018-10-08 17:04:26.888248-0400 testiap[1930:465264] UnityIAP: Requesting 3 products
2018-10-08 17:04:26.889858-0400 testiap[1930:465264] UnityIAP: Requesting product data...
2018-10-08 17:04:27.955846-0400 testiap[1930:465264] UnityIAP: Received 2 products
2018-10-08 17:04:27.958674-0400 testiap[1930:465264] UnityIAP: No App Receipt found
2018-10-08 17:04:27.984345-0400 testiap[1930:465264] UnityIAP: No App Receipt found
Unavailable product subscription -com.unity3d.subscription.new
UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
UnityEngine.Purchasing.AppleStoreImpl:OnProductsRetrieved(String)
UnityEngine.Purchasing.Extension.UnityUtil:Update()
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
OnInitialized: PASS
IAPController:OnInitialized(IStoreController, IExtensionProvider)
UnityEngine.Purchasing.PurchasingManager:CheckForInitialization()
UnityEngine.Purchasing.PurchasingManager:OnProductsRetrieved(List`1)
UnityEngine.Purchasing.AppleStoreImpl:OnProductsRetrieved(String)
UnityEngine.Purchasing.Extension.UnityUtil:Update()
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
UnityIAP: Promo interface is available for 2 items
UnityEngine.Purchasing.Promo:ProvideProductsToAds(HashSet`1)
UnityEngine.Purchasing.AppleStoreImpl:OnProductsRetrieved(String)
UnityEngine.Purchasing.Extension.UnityUtil:Update()
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
2018-10-08 17:04:27.987446-0400 testiap[1930:465264] UnityIAP: Add transaction observer
2018-10-08 17:04:27.987543-0400 testiap[1930:465264] UnityIAP UnityEarlyTransactionObserver: Request to initiate queued payments
---------- Product Value: CAD 2.79
IAPController:BuyProductID(String)
UnityEngine.Events.UnityEvent:Invoke()
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
UnityEngine.EventSystems.StandaloneInputModule:Process()
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
Purchasing product asychronously: 'ca.xxx.consumable'
IAPController:BuyProductID(String)
UnityEngine.Events.UnityEvent:Invoke()
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
UnityEngine.EventSystems.StandaloneInputModule:Process()
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
2018-10-08 17:04:43.320835-0400 testiap[1930:465264] UnityIAP: PurchaseProduct: ca.xxx.consumable
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
2018-10-08 17:04:43.331790-0400 testiap[1930:465264] [MC] Reading from public effective user settings.
purchase({0}): ca.xxx.consumable
IAPController:BuyProductID(String)
UnityEngine.Events.UnityEvent:Invoke()
UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchPress(PointerEventData, Boolean, Boolean)
UnityEngine.EventSystems.StandaloneInputModule:ProcessTouchEvents()
UnityEngine.EventSystems.StandaloneInputModule:Process()
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
2018-10-08 17:04:43.346578-0400 testiap[1930:465264] UnityIAP: UpdatedTransactions
-> applicationWillResignActive()
-> applicationDidBecomeActive()
2018-10-08 17:05:13.987389-0400 testiap[1930:465264] UnityIAP: UpdatedTransactions
2018-10-08 17:05:13.987507-0400 testiap[1930:465264] UnityIAP: PurchaseFailed: 0
onPurchaseFailedEvent({0}): ca.xxx.consumable
UnityEngine.Purchasing.PurchasingManager:OnPurchaseFailed(PurchaseFailureDescription)
UnityEngine.Purchasing.JSONStore:OnPurchaseFailed(PurchaseFailureDescription, String)
UnityEngine.Purchasing.Extension.UnityUtil:Update()
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
OnPurchaseFailed: FAIL. Product: 'ca.xxx.consumable', PurchaseFailureReason: Unknown
IAPController:OnPurchaseFailed(Product, PurchaseFailureReason)
UnityEngine.Purchasing.JSONStore:OnPurchaseFailed(PurchaseFailureDescription, String)
UnityEngine.Purchasing.Extension.UnityUtil:Update()
(Filename: /Users/builduser/buildslave/unity/build/Runtime/Export/Debug.bindings.h Line: 43)
-> applicationWillResignActive()
-> applicationDidEnterBackground()