Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

InApp auto restore

Discussion in 'Unity IAP' started by developHTS, Jun 20, 2018.

  1. developHTS

    developHTS

    Joined:
    Nov 3, 2017
    Posts:
    2
    A problem appeared while testing an app using a test account.
    The app was deleted after an InApp purchase had been made, then was re-installed and the purchase was restored. After these manipulations, further deletions and re-installations make the purchase restore on its own will, without using the restore function, no matter what test account is used.

    How can this problem be solved?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    Is this on Google or iOS? On Google, purchases will automatically be restored.
     
  3. developHTS

    developHTS

    Joined:
    Nov 3, 2017
    Posts:
    2
    Platform IOS
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
  5. vabster

    vabster

    Joined:
    May 12, 2013
    Posts:
    13
    I can't post steps to reproduce or device logs, just wanted to let you know this is happening to me too on an iOS device in Unity 2018.1.5f1
     
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    @vabster Any reason you are not able to provide device logs or steps to reproduce? Perhaps it is because it was reported by a user, and you're not seeing it yourself? We have not seen this behavior here, the logs would be necessary to troubleshoot, thanks.
     
  7. oskar-szulc

    oskar-szulc

    Joined:
    Feb 22, 2013
    Posts:
    6
    @JeffDUnity3D
    The same problem appears in 2017.4.3f1
    Here are log excerpts that might be useful:
    UnityIAP Version: 1.18.0
    UnityEngine.Purchasing.StandardPurchasingModule:Instance(AppStore)
    PurchaseHandler:InitializePurchasing()

    /var/mobile/Containers/Data/Application/283CEC00-98EB-4C64-951B-857FFED8466E/Documents/Unity/0f11d761-1a2e-4742-a98c-f061d7bd6925/IAP/store.json
    UnityEngine.Purchasing.PurchasingManager:Initialize(IInternalStoreListener, HashSet`1)
    PurchaseHandler:InitializePurchasing()

    Log: Fetching optimized store details from https://ecommerce.iap.unity3d.com/catalog?appid=[removed]&deviceid=[removed]&userid=[removed]
    UnityEngine.Purchasing.StoreCatalogImpl:FetchProducts(Action`1)
    PurchaseHandler:InitializePurchasing()

    Log: Failed to fetch IAP catalog due to unexpected http status code, attempting to use cache


    and then comes the list of restore purchase calls in form of


    PurchaseHandler:ProcessPurchase(PurchaseEventArgs)
    UnityEngine.Purchasing.Extension.UnityUtil:Update()
     
  8. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    @oskar-szulc Those calls are expected in the normal initialization flow (the http status code mention is an incorrect error and can be safely ignored). Please provide steps to reproduce.
     
  9. msureka83

    msureka83

    Joined:
    Nov 28, 2014
    Posts:
    32
    Same here. After the last update of Unity IAP, is is automatically restoring purchases. I thought this was a feature of the new IAP update to make it function like android. Is this a bug and not suppose to happen??
     
  10. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    @msureka83 please provide steps to reproduce.
     
  11. reigota

    reigota

    Joined:
    Mar 23, 2010
    Posts:
    62
    This is happening to me with subscription. Each time I uninstall and re-install,
    PurchaseProcessingResult is called several times! All tests I did in this itunes account is returning as a different transaction. The behaviour is exactly the expected one as described here: https://developer.apple.com/library...g.html#//apple_ref/doc/uid/TP40008267-CH8-SW1 except thet NO CONFIRMATION from the user is asked. The receipt is becaming bigger and bigger.. No steps to reproduce, this is happening in my project and I cannot assembly a setup to test it independently. But I am pretty sure you guys can do it.
    btw, unity 2017.4.15 and IAP 1.20.1
     
  12. reigota

    reigota

    Joined:
    Mar 23, 2010
    Posts:
    62
    @JeffDUnity3D Any news about this problem? My restore button is useless and apple is complaining about it. I can't approve my game with subscription now.
     
  13. lolaswift

    lolaswift

    Joined:
    Jan 10, 2019
    Posts:
    21
    I'm running into the same issue. Unity restore my purchase without even asking for my apple sandbox id.

    Anyone of you has found out what's going on?
     
  14. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    @lolaswift Please elaborate. Are you calling the restore method, and it's not prompting for a password? We have no control over the password prompts, we are a pass through service for the store API's.
     
  15. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    Sorry, no steps to reproduce? So this occurs without even a single purchase occurring?
     
  16. lolaswift

    lolaswift

    Joined:
    Jan 10, 2019
    Posts:
    21
    No, I am not calling the restore method. Just exit the app and open it again. When I checked the xcode debug window, the receipt was downloaded by IAP and validated. I asked some senior unity developer yesterday and he said now, it's the designed behavior that unity did it like that just as it did it on android. Is that true?
     
  17. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    No, auto restore on iOS is not expected. It may only be occurring in their Sandbox environment, we have no control over that. And sorry, without steps to reproduce, I would not be able to assist. So you are receiving a Restore operation, without even having purchased anything previously? Please confirm these steps:

    * Install the app, but do not purchase any product
    * Delete and reinstall the app
    * You begin to receive product receipts in ProcessPurchase immediately.
     
  18. zackblack

    zackblack

    Joined:
    May 17, 2015
    Posts:
    18
    I would also like to note this is occurring on my apps as well. Unity 2018.2.20f1. When the publicly released app is downloaded from the iOS App Store, the purchases are automatically restored, but my app never gets any notification or callbacks that this is happening. It is "unlocked", but slipped through detection events.
     
  19. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    What type of product is being restored? Is it a non-consumable or a recurring subscription? And what do you mean, no callbacks? ProcessPurchase would be expected to be called during a restore operation, that is the core issue here. How are you making the determination that restore is occurring?
     
    Last edited: Jan 30, 2019
  20. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    I've been informed by the IAP team that 1.20.1 fixes the auto restore behavior on iOS.
     
  21. zackblack

    zackblack

    Joined:
    May 17, 2015
    Posts:
    18
    Sorry, 1.20.1? Do you mean Unity or IAP system?
     
  22. zackblack

    zackblack

    Joined:
    May 17, 2015
    Posts:
    18
    My apologies, yes - The "no callbacks" was a race condition on my end. :-/
     
  23. lolaswift

    lolaswift

    Joined:
    Jan 10, 2019
    Posts:
    21
    Hi Jeff,I encountered the issue when testing in their Sandbox environment. My IAP items are going through their review process at the moment. I will report it back when they are approved.
     
  24. lolaswift

    lolaswift

    Joined:
    Jan 10, 2019
    Posts:
    21
    What do you mean exactly? Since IAP 1.20.1, auto restore should not happen, correct?
     
  25. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    Yes, that is correct, when in production.
     
  26. mbrindic

    mbrindic

    Joined:
    Mar 13, 2014
    Posts:
    13
    Hi guys, I have same issue about auto-restore purchases on iOS platform with sandbox. I'm wondering is this going to be fixed in the future or not?

    You said that it's fixed in production, but it's really unreliable for me to publish code that is not properly tested...

    I'm using Unity 2017.4.15 with Unity IAP 1.21.
     
    Last edited: Apr 30, 2019
  27. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    Please provide the device logs https://forum.unity.com/threads/how-to-capturing-device-logs-on-ios.529920/
     
  28. mbrindic

    mbrindic

    Joined:
    Mar 13, 2014
    Posts:
    13
  29. Plummers

    Plummers

    Joined:
    Oct 29, 2015
    Posts:
    13
    Hi, I think I have the same iOS testing bug. So initially I put an app in development on my phone through iTunes (drag and drop), bought my darkmode IAP. Now I want to test it again with an updated version of the app.

    1. I deleted the old version from the phone and restarted the phone.
    2. I logged out of all iTunes / sandbox accounts on the phone
    3. I installed new version of my app (drag and drop iTunes)
    4. Started app and it seems on starting up it restores the purchases! I don't press anything.

    Is this correct? It seems however I go about uninstalling/reinstalling/switching accounts that the purchase is stored on the phone somehow.
     
  30. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    You mention "seems on starting up", can you confirm? How are you debugging? Can you provide the device logs? This is actually the opposite behavior of the forum topic, by the way.