Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Rejected from Apple App Store - IAP failing

Discussion in 'Unity IAP' started by jamiewhitephd, May 28, 2020.

  1. jamiewhitephd

    jamiewhitephd

    Joined:
    Jun 8, 2012
    Posts:
    118
    Despite confirmation that our single IAP works across multiple devices, my game has so far been rejected twice from the Apple App Store. They claim the IAP is failing and gave me the following message:

    "We found that your in-app purchase products exhibited one or more bugs when reviewed on iPad running iOS 13.5 on Wi-Fi. Specifically, we received an error message when we attempted to access your in-app purchase."

    Sure enough, when I tested the app on my own personal device, I am constantly requested to enter my Apple ID password only for it to then fail (we made a UI prompt for this). Bizarrely, when I deployed the game onto my wife's device the IAP went through successfully on the first attempt.

    Is there anything anyone can think of to try before we delve into this further? We initially used the codeless IAP functionality but then opted for the code-based solution using Unity's own tutorials. I have completed all of the required tax/financial information. We have yet to try a sandbox user, admittedly, but given that 2 of the 3 users in the internal testing group found success through TestFlight we did not think to add one.
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,372
    Last edited: May 28, 2020
  3. jamiewhitephd

    jamiewhitephd

    Joined:
    Jun 8, 2012
    Posts:
    118
    Hi Jeff,

    The code we used derived from your tutorials, but it is quite big now, overall. However, further below is the important part. Per your recommendations on other posts we implemented receipt validation. However, the problem we are currently facing is that we have three devices, of which two are working fine. The remaining device is my own personal phone which fails to complete the purchase process. It's a 6S+. I am currently updating it to 13.5 now but it's not that far behind (13.4.1) - could this be the issue?


    Code (CSharp):
    1.     public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    2.     {
    3.         bool validPurchase = true; // Presume valid for platforms with no R.V.
    4.  
    5.         // Unity IAP's validation logic is only included on these platforms.
    6. #if UNITY_ANDROID || UNITY_IOS || UNITY_STANDALONE_OSX
    7.         // Prepare the validator with the secrets we prepared in the Editor
    8.         // obfuscation window.
    9.         var validator = new CrossPlatformValidator(GooglePlayTangle.Data(),
    10.             AppleTangle.Data(), Application.identifier);
    11.  
    12.         try
    13.         {
    14.             // On Google Play, result has a single product ID.
    15.             // On Apple stores, receipts contain multiple products.
    16.             var result = validator.Validate(args.purchasedProduct.receipt);
    17.             // For informational purposes, we list the receipt(s)
    18.             Debug.Log("Receipt is valid. Contents:");
    19.  
    20.             foreach (IPurchaseReceipt productReceipt in result)
    21.             {
    22.                 Debug.Log(productReceipt.productID);
    23.                 Debug.Log(productReceipt.purchaseDate);
    24.                 Debug.Log(productReceipt.transactionID);
    25.             }
    26.         }
    27.         catch (IAPSecurityException)
    28.         {
    29.             Debug.Log("Invalid receipt, not unlocking content");
    30.             validPurchase = false;
    31.         }
    32. #endif
    33.  
    34.         if (validPurchase)
    35.         {
    36.             // A consumable product has been purchased by this user.
    37.             if (String.Equals(args.purchasedProduct.definition.id, removeAdsProduct, StringComparison.Ordinal))
    38.             {
    39.                 Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
    40.  
    41.                 // The consumable item has been successfully purchased
    42.                 OnUserPurchasedPremium();
    43.             }
    44.             else
    45.             {
    46.                 Debug.Log(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
    47.             }
    48.         }
    49.  
    50.         // Return a flag indicating whether this product has completely been received, or if the application needs
    51.         // to be reminded of this purchase at next app launch. Use PurchaseProcessingResult.Pending when still
    52.         // saving purchased products to the cloud, and when that save is delayed.
    53.         return PurchaseProcessingResult.Complete;
    54.     }
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,372
    Please provide the device logs, they will contain your Debug.Log statements. Please also see the link I added
     
  5. jamiewhitephd

    jamiewhitephd

    Joined:
    Jun 8, 2012
    Posts:
    118
    Hi Jeff,

    Just tested trying to purchase from xcode, and here is the result:

    Code (CSharp):
    1. OnPurchaseFailed: FAIL. Product: 'IAP_BV_000', PurchaseFailureReason: Unknown
    2. UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
    3. UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    4. UnityEngine.Logger:Log(LogType, Object)
    5. UnityEngine.Debug:Log(Object)
    6. BVIAPManager:OnPurchaseFailed(Product, PurchaseFailureReason)
    7. UnityEngine.Purchasing.StoreListenerProxy:OnPurchaseFailed(Product, PurchaseFailureReason)
    8. UnityEngine.Purchasing.PurchasingManager:OnPurchaseFailed(PurchaseFailureDescription)
    9. UnityEngine.Purchasing.JSONStore:OnPurchaseFailed(PurchaseFailureDescription, String)
    10. UnityEngine.Purchasing.JSONStore:OnPurchaseFailed(String)
    11. UnityEngine.Purchasing.AppleStoreImpl:ProcessMessage(String, String, String, String)
    12. UnityEngine.Purchasing.<>c__DisplayClass36_0:<MessageCallback>b__0()
    13. System.Action:Invoke()
    14. UnityEngine.Purchasing.Extension.UnityUtil:Update()
    The full log is attached to this post. On a side note, any reasons why I also can't get Ad banners to show (works flawlessly on Android)? Errors for that were also observed in the logs
     

    Attached Files:

  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,372
    It could be this:

    2020-05-28 18:25:45.924833+0100 RICCOSHADE[505:13416] UnityIAP: No localized title for: IAP_BV_000. Have your products been disapproved in itunes connect?
    2020-05-28 18:25:45.924952+0100 RICCOSHADE[505:13416] UnityIAP: No localized description for: IAP_BV_000. Have your products been disapproved in itunes connect?

    Also, I saw duplicate log entries, make sure you only initialize IAP only once. The log entries have the same timestamp however

    2020-05-28 18:25:45.923478+0100 RICCOSHADE[505:13416] UnityIAP: Received 1 products
    ...
    2020-05-28 18:25:45.923478+0100 RICCOSHADE[505:13416] UnityIAP: Received 1 products
     
  7. jamiewhitephd

    jamiewhitephd

    Joined:
    Jun 8, 2012
    Posts:
    118
    I logged in to ASC and saw that following the rejection my IAP had been placed into a "developer action needed" state and, sure, enough, the localisation part contained red bullet points. The IAP is now in the "waiting for review" state, but, as I thought, my phone still won't work. This also doesn't explain why my wife's phone worked just fine, even when it was still in the "developer action needed" state.
     
  8. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,372
    Can she purchase again?
     
  9. jamiewhitephd

    jamiewhitephd

    Joined:
    Jun 8, 2012
    Posts:
    118
    Yes, we uploaded a new build to Test Flight just now and can confirm that her (iPhone SE) device works. In addition, we added another person to the team who owns an iPhone X and the purchase was successful (albeit it had failed the first time).

    However, my phone, a 6S+, still does not work and the purchase fails every time. All of this was tested whilst the IAP remains in the "Waiting for Review" state.

    EDIT: Slightly off topic, but, in your experience, is it okay to submit a binary to Apple whilst the IAP is in the "waiting for review" state? At the moment I'm almost terrified that they will fail it without checking on the status of the IAPs in the first place.
     
    Last edited: May 28, 2020
  10. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,372
    I would wait till it clears the review. How are you installing the game, the same way as the other users?
     
  11. jamiewhitephd

    jamiewhitephd

    Joined:
    Jun 8, 2012
    Posts:
    118
    Yes, we each installed the game from Test Flight.

    Given the IAP was working on three out of four devices we decided to hit the submit button and I was not surprised to see yet another rejection this morning - this time they claim that nothing even appears after confirming the purchase, which is something we've never even encountered after testing. At least poor old me got an error message, in my case.

    They claimed to be using WIFI - is there a possibility that the callbacks can take much longer than typically expected to respond in some cases?
     
  12. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,372
    Not likely WiFi related. I would suggest that you publish the Sample IAP project to compare as a test, it works for me on the Apple store. Granted, a chunk of work https://forum.unity.com/threads/sample-iap-project.529555/
     
  13. jamiewhitephd

    jamiewhitephd

    Joined:
    Jun 8, 2012
    Posts:
    118
    Cheers for that Jeff, we essentially used that template project as the basis for our IAPManager class (albeit with the receipt validation factored in). In theory, the IAPs should work if I build and run the project from xcode, right?
     
  14. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,372
    Yes, but Apple has been changing many policies lately. I found this https://forums.developer.apple.com/thread/121940 and https://developer.apple.com/news/?id=08282009a and https://developer.apple.com/documen...ng_in-app_purchase_transactions?language=objc which implies Sandbox accounts are required, and not your developer id.
     
  15. jamiewhitephd

    jamiewhitephd

    Joined:
    Jun 8, 2012
    Posts:
    118
    Okay, thanks for this. I am going to try creating another sandbox user. In the meantime, I have attached another log from the device. Is there anything in there that could suggest the fail reason? The 'unknown' fail reason is not very helpful...
     

    Attached Files:

  16. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,372
    Sorry no. All I can suggest is downloading via TestFlight instead of direct install, as a test.
     
  17. jamiewhitephd

    jamiewhitephd

    Joined:
    Jun 8, 2012
    Posts:
    118
    Ok, thanks for your help. I have scheduled a call with Apple and will let you know the outcome on here once I have spoken to them.
     
  18. jamiewhitephd

    jamiewhitephd

    Joined:
    Jun 8, 2012
    Posts:
    118
    Hi everyone,

    Just to close this post, I uploaded a new build which comprised various fixes to the UI and more but the IAP system was unchanged. I assumed it to be rejected again because of my ongoing problems with the IAP function and had a call with Apple scheduled, but within 50 minutes of it being submitted for review it had passed and is now available on the App Store!

    I truly believe it's down to the person who reviews it on the day and whether said reviewer takes the time to review the functionality repeatedly in case of a fluke. In any case, for whoever comes across this topic, rest assured that using the IAP templates provided by the wonderful people at Unity does the job, and does work as intended, but be prepared to fight with Apple over it.

    Thanks all (and Jeff)
     
    mahmoud93p and JeffDUnity3D like this.
  19. lc0008

    lc0008

    Joined:
    Jun 15, 2020
    Posts:
    4
    Hi jamie,
    On this issue, Do you think this is only Apple's problem?
    I've been rejected five times because of "Unknown" error..
    I had appeal an app rejection, but they always give the same answer as receipts.. As you know, this was before the receipt verification, Right?
    I don't know what to do anymore.
     
  20. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,372
    Does IAP work in your testing?
     
  21. lc0008

    lc0008

    Joined:
    Jun 15, 2020
    Posts:
    4
    yes. It works fine our side even through testflight
     
  22. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,372
  23. lc0008

    lc0008

    Joined:
    Jun 15, 2020
    Posts:
    4
  24. jamiewhitephd

    jamiewhitephd

    Joined:
    Jun 8, 2012
    Posts:
    118
    Hey, sorry, I only just seen your message.

    As I mentioned in my earlier post, when I submitted a new build I had changed literally nothing in the code. Less than an hour later I received my "welcome to the app store" email. I believe my previous rejections were done by people who failed it in the first instance of the purchase failing, and the last person who reviewed it tried it more than once. Or something like that. I since downloaded my game from the app store and deliberately purchased my IAP with my own debit card and saw with amazement the "purchase successful" dialog - Unity's IAP template 100% works.

    Either way, in your case, I would do what I was initially going to do and schedule a call with with the review team (I had one scheduled before it was approved) and ask for clarification, stating that your code came from Unity's own tutorials.

    Some other guidance that may help:
    -- I added a "working..." label attached to an animated "..." effect to show the user something was happening.
    -- I disabled all UI buttons after pressing buy to make sure the user is committed to the purchase function.
    -- I added a pop up that says either thank you for purchasing, or the purchase had failed (also prints the fail reason).

    What does your app do once the user presses a purchase button?
     
unityunity