Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

PurchaseFailureReason: Unknown

Discussion in 'Unity IAP' started by stefanplc, Apr 18, 2018.

  1. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    Hi there,

    I have a mobile game that's live both on Android and iOS. I last updated it at the end of January and in the live version the shop works great. I only have simple consumable products like gems and coins, nothing special. Since then I've worked on updating game mechanics that have nothing to do with the shop so nothing was touched there. I did however update the IAP to the latest version 1.18. I was getting ready to push a new update earlier this week when I noticed that the shop process no longer works, it gives me an error. I've attached 2 log files from which I've stripped any information that might be sensitive to the game. The log.txt file has the game running on my iphone and using my WiFI while log_mobile_network.txt uses the cellphone network. Through the same networks, if I delete my update and just re-download the game from the app store, the shop works just fine. I'd also like to mention that the product IDs are the same on both stores and like I previously mentioned, I haven't made any changes to the shop code which is based on your tutorial from https://unity3d.com/learn/tutorials/topics/ads-analytics/integrating-unity-iap-your-game .

    I also get while running the game in the editor the message "Failed to fetch IAP catalog due to unexpected http status code, attempting to use cache" if that counts for anything.

    Unfortunately I'm not really sure what to do or what to even search for to try and find a solution myself. I would really appreciate any help, thank you!
     
    Last edited: Apr 20, 2018
  2. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    Not sure if this helps, but I tried pushing the same update on an android device and I'm getting "BuyProductID FAIL. Not initialized." However, in my code I do have in my Start() if (m_StoreController == null) { InitializePurchasing(); } and I added a Debug.Log right before it just to make sure it goes through and it does. My InitializePurchasing() is very similar to the one from https://unity3d.com/learn/tutorials/topics/ads-analytics/integrating-unity-iap-your-game .
     
  3. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    I saw btw in the other posts the "1001 - The connection timed out." error. The problem with that however is that if it's a connection issue, shouldn't I be experiencing the same problem with the version of the game that's currently on the store? How come that one works? Thanks!
     
  4. anhnguyen

    anhnguyen

    Joined:
    Oct 15, 2012
    Posts:
    8
    Hi, i face the same right now. Always failed purchase due to unknown reason. Is that itune store timeout?
     
  5. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    I'm also getting it on Android so I think it's something else...
     
  6. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    Here's a stripped down version of my shop code. I removed all the UI/database code and left just the IAP stuff:

    Code (CSharp):
    1. using System;
    2. using System.Collections;
    3. using UnityEngine;
    4. using UnityEngine.Purchasing;
    5.  
    6.  
    7. public class TestShop : MonoBehaviour, IStoreListener {
    8.     private static IStoreController m_StoreController;
    9.     private static IExtensionProvider m_StoreExtensionProvider;
    10.  
    11.     public static string Product1Gems = "gems1";
    12.     public static string Product2Gems = "gems2";
    13.     public static string Product3Gems = "gems3";
    14.     public static string Product4Gems = "gems4";
    15.     public static string Product5Gems = "gems5";
    16.  
    17.     public static string Product1Coins = "coins1";
    18.     public static string Product2Coins = "coins2";
    19.     public static string Product3Coins = "coins3";
    20.     public static string Product4Coins = "coins4";
    21.     public static string Product5Coins = "coins5";
    22.  
    23.     int GemsQuantity;
    24.     int CoinsQuantity;
    25.  
    26.     void Start() {
    27.         if (m_StoreController == null) {
    28.             // Begin to configure our connection to Purchasing
    29.             InitializePurchasing();
    30.         }
    31.     }
    32.  
    33.     public void InitializePurchasing() {
    34.         // If we have already connected to Purchasing ...
    35.         if (IsInitialized()) {
    36.             // ... we are done here.
    37.             return;
    38.         }
    39.  
    40.         // Create a builder, first passing in a suite of Unity provided stores.
    41.         var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
    42.  
    43.         // Add a product to sell / restore by way of its identifier, associating the general identifier
    44.         // with its store-specific identifiers.
    45.  
    46.         builder.AddProduct(Product1Gems, ProductType.Consumable);
    47.         builder.AddProduct(Product2Gems, ProductType.Consumable);
    48.         builder.AddProduct(Product3Gems, ProductType.Consumable);
    49.         builder.AddProduct(Product4Gems, ProductType.Consumable);
    50.         builder.AddProduct(Product5Gems, ProductType.Consumable);
    51.  
    52.         builder.AddProduct(Product1Coins, ProductType.Consumable);
    53.         builder.AddProduct(Product2Coins, ProductType.Consumable);
    54.         builder.AddProduct(Product3Coins, ProductType.Consumable);
    55.         builder.AddProduct(Product4Coins, ProductType.Consumable);
    56.         builder.AddProduct(Product5Coins, ProductType.Consumable);
    57.  
    58.         // Kick off the remainder of the set-up with an asynchrounous call, passing the configuration
    59.         // and this class' instance. Expect a response either in OnInitialized or OnInitializeFailed.
    60.         UnityPurchasing.Initialize(this, builder);
    61.     }
    62.  
    63.     private bool IsInitialized() {
    64.         // Only say we are initialized if both the Purchasing references are set.
    65.         return m_StoreController != null && m_StoreExtensionProvider != null;
    66.     }
    67.  
    68.     public void BuyGems1() {
    69.         BuyProductID(Product1Gems);
    70.     }
    71.     public void BuyGems2() {
    72.         BuyProductID(Product2Gems);
    73.     }
    74.     public void BuyGems3() {
    75.         BuyProductID(Product3Gems);
    76.     }
    77.     public void BuyGems4() {
    78.         BuyProductID(Product4Gems);
    79.     }
    80.     public void BuyGems5() {
    81.         BuyProductID(Product5Gems);
    82.     }
    83.  
    84.  
    85.     public void BuyCoins1() {
    86.         BuyProductID(Product1Coins);
    87.     }
    88.     public void BuyCoins2() {
    89.         BuyProductID(Product2Coins);
    90.     }
    91.     public void BuyCoins3() {
    92.         BuyProductID(Product3Coins);
    93.     }
    94.     public void BuyCoins4() {
    95.         BuyProductID(Product4Coins);
    96.     }
    97.     public void BuyCoins5() {
    98.         BuyProductID(Product5Coins);
    99.     }
    100.    
    101.  
    102.  
    103.     void BuyProductID(string productId) {
    104.         // If Purchasing has been initialized ...
    105.         if (IsInitialized()) {
    106.             // ... look up the Product reference with the general product identifier and the Purchasing
    107.             // system's products collection.
    108.             Product product = m_StoreController.products.WithID(productId);
    109.  
    110.             // If the look up found a product for this device's store and that product is ready to be sold ...
    111.             if (product != null && product.availableToPurchase) {
    112.                 Debug.Log(string.Format("Purchasing product asychronously: '{0}'", product.definition.id));
    113.                 // ... buy the product. Expect a response either through ProcessPurchase or OnPurchaseFailed
    114.                 // asynchronously.
    115.                 m_StoreController.InitiatePurchase(product);
    116.             }
    117.             // Otherwise ...
    118.             else {
    119.                 // ... report the product look-up failure situation
    120.                 Debug.Log("BuyProductID: FAIL. Not purchasing product, either is not found or is not available for purchase");
    121.             }
    122.         }
    123.         // Otherwise ...
    124.         else {
    125.             // ... report the fact Purchasing has not succeeded initializing yet. Consider waiting longer or
    126.             // retrying initiailization.
    127.             Debug.Log("BuyProductID FAIL. Not initialized.");
    128.         }
    129.     }
    130.  
    131.  
    132.     // Restore purchases previously made by this customer. Some platforms automatically restore purchases, like Google.
    133.     // Apple currently requires explicit purchase restoration for IAP, conditionally displaying a password prompt.
    134.     public void RestorePurchases() {
    135.         // If Purchasing has not yet been set up ...
    136.         if (!IsInitialized()) {
    137.             // ... report the situation and stop restoring. Consider either waiting longer, or retrying initialization.
    138.             Debug.Log("RestorePurchases FAIL. Not initialized.");
    139.             return;
    140.         }
    141.  
    142.         // If we are running on an Apple device ...
    143.         if (Application.platform == RuntimePlatform.IPhonePlayer ||
    144.             Application.platform == RuntimePlatform.OSXPlayer) {
    145.             // ... begin restoring purchases
    146.             Debug.Log("RestorePurchases started ...");
    147.  
    148.             // Fetch the Apple store-specific subsystem.
    149.             var apple = m_StoreExtensionProvider.GetExtension<IAppleExtensions>();
    150.             // Begin the asynchronous process of restoring purchases. Expect a confirmation response in
    151.             // the Action<bool> below, and ProcessPurchase if there are previously purchased products to restore.
    152.             apple.RestoreTransactions((result) => {
    153.                 // The first phase of restoration. If no more responses are received on ProcessPurchase then
    154.                 // no purchases are available to be restored.
    155.                 Debug.Log("RestorePurchases continuing: " + result + ". If no further messages, no purchases available to restore.");
    156.             });
    157.         }
    158.         // Otherwise ...
    159.         else {
    160.             // We are not running on an Apple device. No work is necessary to restore purchases.
    161.             Debug.Log("RestorePurchases FAIL. Not supported on this platform. Current = " + Application.platform);
    162.         }
    163.     }
    164.  
    165.  
    166.     //
    167.     // --- IStoreListener
    168.     //
    169.  
    170.     public void OnInitialized(IStoreController controller, IExtensionProvider extensions) {
    171.         // Purchasing has succeeded initializing. Collect our Purchasing references.
    172.         Debug.Log("OnInitialized: PASS");
    173.  
    174.         // Overall Purchasing system, configured with products for this application.
    175.         m_StoreController = controller;
    176.         // Store specific subsystem, for accessing device-specific store features.
    177.         m_StoreExtensionProvider = extensions;
    178.     }
    179.     public void OnInitializeFailed(InitializationFailureReason error) {
    180.         // Purchasing set-up has not succeeded. Check error for reason. Consider sharing this reason with the user.
    181.         Debug.Log("OnInitializeFailed InitializationFailureReason:" + error);
    182.     }
    183.  
    184.  
    185.     public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args) {
    186.         if (String.Equals(args.purchasedProduct.definition.id, Product1Gems, StringComparison.Ordinal)) {
    187.             GemsQuantity = 30;
    188.             StartCoroutine("DatabasePurchaseGems");
    189.         } else if (String.Equals(args.purchasedProduct.definition.id, Product2Gems, StringComparison.Ordinal)) {
    190.             GemsQuantity = 70;
    191.             StartCoroutine("DatabasePurchaseGems");
    192.         } else if (String.Equals(args.purchasedProduct.definition.id, Product3Gems, StringComparison.Ordinal)) {
    193.             GemsQuantity = 120;
    194.             StartCoroutine("DatabasePurchaseGems");
    195.         } else if (String.Equals(args.purchasedProduct.definition.id, Product4Gems, StringComparison.Ordinal)) {
    196.             GemsQuantity = 180;
    197.             StartCoroutine("DatabasePurchaseGems");
    198.         } else if (String.Equals(args.purchasedProduct.definition.id, Product5Gems, StringComparison.Ordinal)) {
    199.             GemsQuantity = 250;
    200.             StartCoroutine("DatabasePurchaseGems");
    201.  
    202.  
    203.  
    204.         } else if (String.Equals(args.purchasedProduct.definition.id, Product1Coins, StringComparison.Ordinal)) {
    205.             CoinsQuantity = 20;
    206.             StartCoroutine("DatabasePurchaseCoins");
    207.         } else if (String.Equals(args.purchasedProduct.definition.id, Product2Coins, StringComparison.Ordinal)) {
    208.             CoinsQuantity = 50;
    209.             StartCoroutine("DatabasePurchaseCoins");
    210.         } else if (String.Equals(args.purchasedProduct.definition.id, Product3Coins, StringComparison.Ordinal)) {
    211.             CoinsQuantity = 80;
    212.             StartCoroutine("DatabasePurchaseCoins");
    213.         } else if (String.Equals(args.purchasedProduct.definition.id, Product4Coins, StringComparison.Ordinal)) {
    214.             CoinsQuantity = 110;
    215.             StartCoroutine("DatabasePurchaseCoins");
    216.         } else if (String.Equals(args.purchasedProduct.definition.id, Product5Coins, StringComparison.Ordinal)) {
    217.             CoinsQuantity = 150;
    218.             StartCoroutine("DatabasePurchaseCoins");
    219.         }
    220.  
    221.         // Return a flag indicating whether this product has completely been received, or if the application needs
    222.         // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
    223.         // saving purchased products to the cloud, and when that save is delayed.
    224.         return PurchaseProcessingResult.Complete;
    225.     }
    226.  
    227.  
    228.     public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason) {
    229.         // A product purchase attempt did not succeed. Check failureReason for more detail. Consider sharing
    230.         // this reason with the user to guide their troubleshooting actions.
    231.         Debug.Log(string.Format("OnPurchaseFailed: FAIL. Product: '{0}', PurchaseFailureReason: {1}", product.definition.storeSpecificId, failureReason));
    232.     }
    233.  
    234.     IEnumerator DatabasePurchaseGems() {
    235.         yield return new WaitForSeconds(1f);
    236.         // This is where I connnect to my database and add the gems
    237.     }
    238.  
    239.     IEnumerator DatabasePurchaseCoins() {
    240.         yield return new WaitForSeconds(1f);
    241.         // This is where I connnect to my database and add the coins
    242.     }
    243.  
    244. }
    245.  
     
  7. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    And attached you can see a screenshot showing the product IDs from my Apple Store and Google Store. They're identical and correctly added inside the code.

    Also the game is called TomeOfHeroes, if you need to install the live version you can find the links at www.tomeofheroes.com

    Let me know if there's any other information that I can provide and thanks in advance for any help!
     

    Attached Files:

  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    The 1001 error is a store timeout. Can you provide your Android logs too?
     
  9. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    Hey Jeff, unfortunately I'm not able to provide Android logs at the moment. So my understanding is that the 1001 error means that there's something wrong with the connection from my device and to the Apple Store correct? However, if that's the case, why doesn't the live version of the app provide the same error and only the new update? If it's a connection issue, shouldn't both return the same 1001 timeout considering I'm running them from the same device and over the same connection?
     
  10. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @stefanplc Agreed on your observations. I'm checking with the IAP team whether there were any changes to the timeout settings in the latest version, and will keep you updated.
     
  11. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    Thank you very much Jeff, appreciate your help!
     
  12. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    Here's the Android log that I stripped down a bit of any info that may be sensitive to the app. Thanks!
     
  13. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @stefanplc It looks like IAP initialization is failing, but I'm not seeing it called anywhere. Where in your code are you initializing IAP? Should be in Start()
     
  14. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    Isn't it the call at line 29? InitializePurchasing(); The function is right bellow it starting with line 33.
     
  15. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, but I'm not seeing the initialization in the logs. Perhaps you stripped it out? To capture logs on Android, I generally use "adb logcat | grep -i unity". On Windows, I use findstr instead of grep.
     
  16. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    Here's a new full log from Android Studio. Let me know if this helps, thanks!
     
  17. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    And here's a full iOS log of the same process. I open the game, open the shop window and press the buy button.
     
  18. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please use grep/findstr as requested, it will save time to isolate any Unity errors. Please provide line numbers of errors that you see, I will confirm and look for other possible issues. Thank you for understanding.
     
  19. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    Hey Jeff, unfortunately I don't know what grep/findstr are, but I did google them and looking at what you wrote, I believe you would just like me to list out the errors I'm seeing in the logs regarding the IAP?

    --------------

    In the log_android_full.txt file here are the lines that refer to the Unity IAP:

    Line 224: I/Unity: UnityIAP Version: 1.18.0
    Line 234: I/UnityIAP: IAB helper created.
    Line 326: I/UnityIAP: Starting in-app billing setup.
    Line 327: I/UnityIAP: Billing service connected.
    Line 328: I/UnityIAP: invoking callback
    Line 330: I/UnityIAP: In-app billing version 3 supported for com.pulciu.tomeofheroes
    Line 331: I/UnityIAP: Subscriptions AVAILABLE.
    Line 332: I/UnityIAP: VR supported.
    Line 336: I/UnityIAP: invoking callback
    Line 340: I/UnityIAP: Owned items response: 0

    Error:
    Line 343: I/UnityIAP: getSkuDetails() failed: 6:Error
    onQueryInventoryFinished: false
    Error refreshing inventory (querying prices of items). (response: 6:Error)
    Failed to Query inventory. UnityIAP will automatically retry in 5000ms
    QueryInventory: 10
    invoking callback

    The same error appears to occur again at lines 396, 422, 434 and 452.

    --------------

    In the log_ios_full.txt file here are the lines that refer to the Unity IAP:

    Line 231: UnityIAP Version: 1.18.0
    Line 232: UnityEngine.Purchasing.StandardPurchasingModule:Instance(AppStore)
    Line 233: Shop:InitializePurchasing()
    Line 259: Fetching optimized store details from https://ecommerce.iap.unity3d.com/c...C2CAD&userid=d6ead783c3be748cf8ff8402eb75b378
    Line 377: Failed to fetch IAP catalog due to unexpected http status code, attempting to use cache
    Line 391: UnityIAP:Requesting 10 products
    Line 393: UnityIAP:Requesting product data...
    Line 317: UnityIAP:Received 10 products
    Line 491: UnityIAP:No App Receipt found
    Line 421: UnityIAP:No App Receipt found
    Line 441: UnityIAP: Promo is ready
    Line 455: UnityIAP:Add transaction observer
    Line 457: UnityIAP UnityEarlyTransactionObserver: Request to initiate queued payments
    Line 491: UnityIAP:purchaseProduct: gems1
    Line 493: UnityIAP:UpdatedTransactions
    Line 495: purchase({0}): gems1
    Line 513: UnityIAP:UpdatedTransactions

    Error:
    Line 515: UnityIAP:purchaseFailed: 0
    Line 517: onPurchaseFailedEvent({0}): gems1
    Line 519: UnityEngine.Purchasing.PurchasingManager:OnPurchaseFailed(PurchaseFailureDescription)
    Line 521: UnityEngine.Purchasing.JSONStore:OnPurchaseFailed(PurchaseFailureDescription, String)
    Line 523: UnityEngine.Purchasing.Extension.UnityUtil:Update()
    Line 531: OnPurchaseFailed: FAIL. Product: 'gems1', PurchaseFailureReason: Unknown
    Line 533: Shop:OnPurchaseFailed(Product, PurchaseFailureReason)
    Line 535: UnityEngine.Purchasing.JSONStore:OnPurchaseFailed(PurchaseFailureDescription, String)
    Line 537: UnityEngine.Purchasing.Extension.UnityUtil:Update()

    --------------

    Is this what you needed me to do?
    Thanks!
     
    Last edited: Apr 20, 2018
  20. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    I just looked at the tutorial article again and compared it with my shop script and as expected they're almost identical, I just have a few extra lines of code for UI animations. I'm going to try and update from Unity 2017.2.0p1 to 2017.4.1 and see if that does anything. I'll keep you updated, thanks!
     
  21. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    I updated to 2017.4.1 and re-imported the IAP but still nothing, same errors.
     
  22. acr1378

    acr1378

    Joined:
    Dec 4, 2014
    Posts:
    76
    I am experiencing the same problem. I had a a live build with IAP functioning properly. Everything seemed ok in the TestFlight environment and the live version was ok (although I was getting a lot of PurchaseFailure.UserCancelled errors). I went to work on other things, and updated to IAP 1.18, and now the IAP system doesn't work.

    When you hit the purchase button, the app just sits there, for a very long time (about 3-4 minutes), and eventually returns a PurchaseFailure.unknown error. I got some log reports from XCode, and they do appear to have the 1001 timeout error. Specifically, the CPU was caught waking 45001 times over 215 seconds, violating the CPU wakes limit.

    I'm attaching a screenshot of the log files here. On another note, working with the IAP system has been endlessly frustrating. We have been struggling with it for 6 months, and every update causes huge problems. The feedback from log reports is usually useless (PurchaseFailure.unknown!) and the documentation is still very poor 6 months in. The Unity team really needs to do something about this as this code base is not up to Unity standards, which I have found otherwise to be very high. Moreover, as the IAP system is absolutely critical to monetizing games, and can be a huge source of negative user feedback when it goes wrong, this should be a top priority.
     

    Attached Files:

  23. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    May I please get a list of all the files that get updated when I update the IAP? I know the folders UityChannel and UnityPurchasing do, but I think there may be a couple of other files too. I tried going back to Unity 1.15 by downloading those 2 folders from an older GitHub backup and it's still not working so I'm wondering if I missed some.

    Or is there a better way to downgrade to a previous version of the IAP?

    Thanks!
     
  24. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Supporting downgrading is a feature we are working on. In the meantime, many developers take advantage of a source control system to perform downgrades. I do understand your frustration. All the necessary files are contained in Assets/Plugins/UnityPurchasing and Assets/Plugins/UnityChannel. What is the error that you are seeing when trying to move to the earlier release? This post may help: https://forum.unity.com/threads/iap-troubleshooting-remove-and-reinstall-unity-iap.511747/
     
    Last edited: Apr 18, 2018
  25. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  26. unityjingyao

    unityjingyao

    Unity Technologies

    Joined:
    Feb 20, 2017
    Posts:
    220
    Hi @stefanplc , @acr1378 ,
    Regarding the -1001 error, it's indeed an issue in Apple Sandbox.
    You can find the system status of Apple on this page:
    https://developer.apple.com/system-status/
    upload_2018-4-19_11-10-31.png
    You can see that there is still an issue in iTunes Sandbox, the rest services are running well.
    And there is an upcoming maintenance for TestFlight.
    So even if you downgrade Unity IAP to an old version, it still doesn't work.
    And the return code 0 means "Unknown". Apple might show an unexpected behavior since there is an issue in Sandbox.

    @stefanplc .
    Regarding the issue on Android platform, the error "failed: 6:Error" is BILLING_RESPONSE_RESULT_ERROR which means "Fatal error during the API action".
    https://developer.android.com/google/play/billing/billing_reference.html
    I don't know the cause so far. Could you please open a support ticket and send us your test apk file so that we can test it?
    https://analytics.cloud.unity3d.com/support/
    Thank you.
     
  27. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    Hey guys,
    Thank you so much for the fast replies! Here's an update from my end: I spent all day yesterday trying to roll back via github in increments of every 1 month and then I pushed those builds on my test phones for both Android and iOS to see if the shop worked since it appears to do so on the live version. This took a while as each roll back required roughly 30 minutes of Unity re-importing the files. Eventually I got to December where I was using IAP 1.15 and even though it didn't work still, on Android I was now getting a pop-up message from Google Play that the product wasn't available for purchase. Before with 1.18 it wasn't doing anything at all. On iOS, with 1.18 the iPhone wouldn't do anything for a few minutes and then it would give me the unknown error with 1.15 it gave me the error right away.

    I did some more research and the errors of "No App Receipt found" in iOS (lines 419 and 421) and product not available for purchase on Adroid might actually be from the store and the only way to fix them is to push the update live.

    So next I took the 2 folders from the Plugin folder titled UityChannel and UnityPurchasing from my December version and I placed them in my latest update. It took a couple of Unity restarts but eventually I got it to give me the same error from December on this latest build. I then used the links with the IAP packages that you guys provided and upgraded to 1.16 and that seemed to provide the same errors too. I didn't get a chance to try 1.17 yet but I will do that shortly. I should also mentioned that I first tried this with Unity 2017.4 and I didn't get the same results. I had to do it with Unity 2017.2.0p1 which is what I've been using for the past few months.

    My plan is to push my app on both stores with either IAP 1.16 or 1.17 and see how that goes. Luckily I don't have a lot of users playing my game as I would like to add a bit more content before I start marketing so it shouldn't be that big of a deal if it ends up not working.

    I'll let you know how things go,
    Thanks!
     
  28. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    Hey guys,

    My submission to the iOS app store just got approved and should be live on all stores in a few hours. I ended up going with IAP 1.17. I assume that in the end the errors were as I explained that the purchase process doesn't work unless the app is downloaded from the store. Last time I worked on the shop part of my game, I was able to just push updates directly to my devices from my computer and test the shop that way but I guess that's no longer the case.

    I didn't actually get to test that everything's working fine, but I don't think Apple would have approved my update if there were any issues. If I do encounter any problems I'll let you guys know. Thank you very much for all of your help and assistance! :)
     
  29. stefanplc

    stefanplc

    Joined:
    Feb 21, 2015
    Posts:
    82
    The stores actually updated a lot faster than expected and I can confirm the shop works great on both Android and iOS :D. Thanks again!
     
  30. Calvin2274

    Calvin2274

    Joined:
    Sep 11, 2014
    Posts:
    17
    Hi, I am facing the same issue with iOS ONLY. Android is completely working fine.

    It able to find products and get those price, but always filed OnPurchaseFailed with Unknown reason once clicked the item:

    IAPButton.OnPurchaseFailed(Product UnityEngine.Purchasing.Product, PurchaseFailureReason Unknown)

    Unity 2018.2.8f1
    Unity IAP: 2.0.3

    Anyone could help ?
     
  31. unityjingyao

    unityjingyao

    Unity Technologies

    Joined:
    Feb 20, 2017
    Posts:
    220
    Hi @Calvin2274 ,
    Please make sure that you have filled out the Business and Tax Info on iTunesConnect.
     
  32. eonyanov

    eonyanov

    Joined:
    Oct 6, 2014
    Posts:
    21
    Hi, I get an error "PurchaseFailureReason: Unknown" after I bought a subscription with a trial period, then I canceled it until the trial period ended, and then I try to restore my purchases. In the AppStore settings on iPhone I do not have a subscription, but the trial period is still valid. But in fact, I have a error in the game and there is no possibility to use a subscription until the end of the trial period.
    Unity 2018.3.4f1.
     
  33. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    When and how are you receiving the error. Please provide specific steps to reproduce. And please check your grammar "canceled it until the trial period ended" is a bit confusing.
     
  34. eonyanov

    eonyanov

    Joined:
    Oct 6, 2014
    Posts:
    21
    Sorry for bad english.
    My steps:
    1. Run game.
    2. Hit "Buy subscription" button (for 3 month with 3 free day period).
    3. Entered account password.
    4. Got successful purchase window from AppStore.
    5. Return to the game
    6. Checked subscription activated.
    7. Exit game, delete game.
    8. Go to Settings > iTunes & App Store, tap my Apple ID at the top of the screen, tap View Apple ID, entered password, tap Subscriptions, tap Cancel Subscription. Subscription is canceled, but there is a text "Expires 28 Feb 2019".
    9. Download again my game from Appstore and run.
    10. Hit "Restore Purchases" button.
    11. Got error in my special debug log window (opened after 3 seconds touching in special place on the screen).
     
  35. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Got it! You mentioned the Package Manager version, what is the IAP Asset version? Go to Window/Unity IAP/IAP Updates and the version will be listed at the top of the dialog. The latest is 1.20.1. We are hoping to improve the disconnected scenario in upcoming releases. In the meantime, you likely don't want to give the user the product when you encounter this error.
     
  36. eonyanov

    eonyanov

    Joined:
    Oct 6, 2014
    Posts:
    21
    upload_2019-2-27_23-35-14.png

    But yesterday I updated both components of Unity IAP and now have this:
    upload_2019-2-27_23-38-46.png

    After that I uploaded new build on AppStore, but it still is pending of review.
     
  37. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Did you test and confirm behavior before uploading a new build? I'm not clear why you uploaded a new version? You would want to test in TestFlight first, or on your own device before publishing a new release.
     
  38. eonyanov

    eonyanov

    Joined:
    Oct 6, 2014
    Posts:
    21
    In Sandbox I can't test this scenario because I can't cancel my subscription. The rest of the functionality works well. In addition, the free period expires very quickly in Sandbox. And since this scenario has a small chance I decided to test on the released game.
     
  39. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, you would need to create a new subscription, or use a new user account
     
  40. eonyanov

    eonyanov

    Joined:
    Oct 6, 2014
    Posts:
    21
    No, that's not the problem. In the Sandbox there is no functionality at all to cancel the subscription. It doesn't matter whether a new user or not.
     
  41. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes it does. A new user would be able to subscribe. Cancelling a subscription is on a per-user basis. Other users can still purchase.
     
  42. francismoy

    francismoy

    Joined:
    Jul 5, 2017
    Posts:
    46
    I had also this error, in particular "getSkuDetails() failed: 6:Error", and in my case it was a misconfiguration in my device: I had three different Google accounts and only one of them had testing permissions, so I basically removed all but that one from the device.


     
  43. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We have determined one cause of the 6:error is changing the users password on Google Play on the web, but not (yet) on an unlocked (no screen lock in place) device
     
  44. OzgunAkk

    OzgunAkk

    Joined:
    Sep 19, 2017
    Posts:
    4
    I have a similar problem. I'm using IAP button and when i click buy product its giving me purchase
    failed, reason unknown error. I'm using Unity 2019.2.13f and last version of iap. Any help?. Thanks.
     
  45. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  46. Sohaib_techverx

    Sohaib_techverx

    Joined:
    Aug 15, 2019
    Posts:
    16
    I am having issue with the live version on iOS, the in-app purchases are working fine on Sandbox environment but the live version fails on OnInitializeFailed. On Android everything is working fine.

    All the tax and banking information is added and in-app purchases are also Approved but still somehow they are not working only on live version.
     
    Last edited: Aug 24, 2020
  47. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please provide the device logs from XCode
     
  48. Sohaib_techverx

    Sohaib_techverx

    Joined:
    Aug 15, 2019
    Posts:
    16
    Thanks for your response but the in-app purchases started working automatically after a while. I don't know how but I guess there was a delay from Apple regarding in-app purchases.
     
  49. MaxBNvizzio

    MaxBNvizzio

    Joined:
    Jan 28, 2020
    Posts:
    2
    Hello,

    I am facing a similar issue on an app currently in production on a mobile device.
    Purchases work fine on all iOS and Android devices except for one device: Samsung S7.

    For that device, the IStoreListener.OnPurchaseFailed method is called with a PurchaseFailureReason of Unknown.Here is an excerpt from our logs:
    The first log entry is emitted by Unity code the second is by our OnPurchaseFailed method implementation from the IStoreListener interface:

    Code (CSharp):
    1. -[Log] onPurchaseFailedEvent({0}): CardPack_SixFlags
    2. UnityEngine.Purchasing.Extension.UnityUtil:Update()
    3.  
    4. -[Error] IAP InAppPurchaseManager -- OnPurchaseFailed -- productID: CardPack_SixFlags, reason: Unknown
    5. Nvizzio.RCTM.IAP.UnityIAPManager:OnPurchaseFailed(Product, PurchaseFailureReason)
    6. UnityEngine.Purchasing.Extension.UnityUtil:Update()

    As mentioned above, the same code is executed on all devices but failures occur only for this particular device.
    The Unity version used is 2018.4.20f1How can we:
    • obtain more details as to what is causing the issue?
    • fix/workaround the problem?
    Thanks in advance,
    Max
     
  50. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I have a Galaxy S7 Edge and IAP works great on it. Are you testing with the latest IAP version 2.0.0? So you have that specific device and are able to reproduce?