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

IAP restore issues (Android)

Discussion in 'Unity IAP' started by DanWeston, Mar 31, 2019.

  1. ForteBass

    ForteBass

    Joined:
    Nov 20, 2015
    Posts:
    2
    I'll also throw my hat into this bucket. I've been quietly waiting for 6 months to have this bug fixed.

    "Just a few more weeks, just a few more weeks". - @JeffDUnity3D
     
    AakashDP and Sailendu like this.
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,471
    We hear you, personally this is my top issue. Unfortunately there are some release issues that are out of our direct control as we try to coordinate with the various store API's, it may be quite a few more weeks. I'm pushing for a faster resolution and will keep this thread updated with any developments.
     
  3. Sailendu

    Sailendu

    Joined:
    Jul 23, 2009
    Posts:
    175
    ok :(
     
    AakashDP likes this.
  4. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    190
    Hi Jeff,

    What does this mean?
    upload_2020-6-22_18-42-23.png

    I just received iAp update, but without any description.
     
    nicholasr likes this.
  5. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,471
    A description is forthcoming, stay tuned to this forum!
     
  6. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    190
    Can you give a hint now? :)
    Cause i need to make a bulid for tomorrow testing, and need to decide right now, should i include the new iAp there.
     
  7. DarekRusin

    DarekRusin

    Joined:
    Nov 15, 2013
    Posts:
    38
    There's some info here:
    https://assetstore.unity.com/packages/add-ons/services/billing/unity-iap-68207#releases

     
    nicholasr likes this.
  8. pertz

    pertz

    Joined:
    Jan 8, 2015
    Posts:
    100
    The changelog is on the Asset Store, but it doesnt mention anything regarding the bug of this topic (Unity automatically/wrongly consuming a NonConsumable purchase)

    (oops, DarekRusin beat me to it :cool:)

    Version 1.23.2(current)

    Released: Jun 22, 2020

    - GooglePlay
    -- Improves the chance of successfully purchasing a Consumable or NonConsumable, and the chance of completing (aka ConfirmPendingPurchase) when the purchase flow is interrupted. Also addresses the dialog, "Your order is still being processed". And this also works across app reboots.
    -- Adds ownership information to the JSON receipt, also exposed via IGooglePlayStoreExtensions.IsOwned(Product).
    -- Adds void IGooglePlayStoreExtensions.SetLogLevel(int level) API to reduce logging. Fix - GooglePlay - Handles the "You already own this product" dialog from Google Play.
     
  9. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    190
    Thanks!
    I don't see anything about restoring purchases though. The all things we were crying about here.
     
    Sailendu likes this.
  10. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,471
    Due to ongoing coordination efforts with Google, the Restore issue is not directly addressed in this release, but you may see improvements.
     
  11. AdamVlcek

    AdamVlcek

    Joined:
    Aug 8, 2013
    Posts:
    2
    Also got my first report of Android IAP issues related to multiple devices and restore yesterday. Spent two days trying to find problems in my code, communicating with the unfortunate guy, and by searching forums. It looks like I'm lucky to find this thread so soon...

    How is it possible, that such a MAJOR issue is geting so little attention?!

    Well, guys, money? Ever heard about it? It's the reason why most people (except you, obviously) make apps and games. And it's pretty hard to get people to pay for your work. And then, when they pay... it does not work! Upset users, bad reviews, loss of credibility, lots of time lost on support and debugging apps.... should I continue? This is even worse than crashing! Users are somewhat used to apps sometimes going down, but this makes the developers look like scam! ... But, well, give me a year or two and maybe you may see improvements... no, not really addressed the problem... I have just a few paying customers right now, but a problem like this can easily kill a project and I'm very angry at Unity right now!
     
    Sailendu likes this.
  12. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,471
    On the contrary, it has a lot of attention! We are trying to coordinate a solution with Google.
     
  13. Sailendu

    Sailendu

    Joined:
    Jul 23, 2009
    Posts:
    175
    @JeffDUnity3D can you please please please tell us, if it has a lot of attention then why is it not getting fixed even after months? And it would be great if you would give us a clear answer about why is it so hard to fix this issue, instead of "coordination efforts" and "release issues that are out of our direct control", I really wish to know what exactly the true issue here, it is not like in-app purchases restoring is not working in the entire Android platform, is there something that Google needs to fix for Unity IAP to work? Or the issue entirety in the Unity IAP? As Unity IAP is in the Package Manager, I thought it would be great as a modular system because they can fix issues without us needing to update to a new Unity version. But still it is taking months. I wish you had some mercy upon us and give us a good system for IAP which is officially by Unity. Sorry for the rant, but honestly I don't understand what's the real issue here.

    Can anybody please tell me, if there is some other IAP solution I can use? I've never used any third party solution for IAP, does anybody know a good one?
     
    Last edited: Jun 23, 2020
  14. pertz

    pertz

    Joined:
    Jan 8, 2015
    Posts:
    100
    I cant confirm but some users on this thread have reported that migrating back to IAP 1.17 will "solve" the issue.

    "Solve" as in "the IAP module will stop consuming purchases incorrectly/automatically". But all the past consumed purchases are gone forever (which in my case is around hundreds or maybe thousands of customers), so you will still get complains/bad reviews/angry customers (rightfully)/etc, even months after migrating back to IAP 1.17.

    Regarding getting Unity to say something, good luck. They havent even yet CONFIRMED that there is a bug on their side, and that they are consuming purchases incorrectly. All the solid information comes from other devs, and all Unity do is to dodge. It's been like that for 14 months now, I dont think they will suddenly change.
     
  15. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,471
    We are in IP discussions with Google, we are delayed by legal issues unfortunately
     
  16. MigrantP

    MigrantP

    Joined:
    Jun 24, 2013
    Posts:
    64
    I don't have the Unity IAP source code but here is a pseudocode bug fix that would help at least a little bit going forward while the legal issues are being sorted out:

    if (product.Type == NonConsumable)
    {
    DO NOT UNDER ANY CIRCUMSTANCES CALL consumeAsync() ON THIS PRODUCT!
    }
     
    Sailendu likes this.
  17. Sailendu

    Sailendu

    Joined:
    Jul 23, 2009
    Posts:
    175
    @pertz Thanks for the info, in almost all the complains I receive from customers, the issue is that when they install on a 2nd device, the purchase is not restored. I don't know what happens if they try to make the purchase again on the 2nd device, because I did not ask them to try purchasing again.

    I tested this on my two devices, with test account purchase. Restore works on the first device if I delete and re-install the game, and if I try to make the purchase again on the 1st device it shows "duplicate purchase" error (as it's a non-consumable item). but when I installed on the 2nd device the restore did not happen, then when I tried purchasing it on the 2nd device it allowed me to purchase again, as if it was a consumable item. And in my code the item is defined as non-consumable and the 1st device giving "duplicate purchase" error shows that it's a non-consumable item.

    So is my issue same with what is being discussed here? Please let me know. I am using IAP 1.23.1, you mentioned about downgrading to 1.17, I don't know how to downgrade, where can I download older IAP versions? Please let me know.
     
  18. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    147
    Sailendu likes this.
  19. Sailendu

    Sailendu

    Joined:
    Jul 23, 2009
    Posts:
    175
    Thanks a lot for the info, I will definitely try downgrading to 1.19 using the steps you mentioned in the other thread. These are really helpful information.

    So this got me thinking, as currently downgrading to 1.19 works, without Google making any changes on their side. Then it is clear that the issue is in the newer Unity IAP versions, then why they are not able to find the issue? Even after many months. I really don't understand.
     
  20. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,471
    There are discussions of two separate issues in this thread. 1) Restore across devices 2) Consuming the product. These are separate issues, we made progress on 2) in the last release.
     
  21. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    190
    We tried 1.23.2, and it seems the issue with restoring purchases became worse.
    At least before i didn't get reports of this issue from our test team, they always had purchases restored on another device with the same account, so all reports were coming form the users, but testers were unable to reproduce the issue. Until now, with update to 1.23.2 they reproduced it at once. So i need to roll back to 1.23.1, is there a way to get archive with this version?

    UPD: After more tests - it's not so bad after all. Testers were able to fix it with cache cleaning, and more important, it now restores purchase on "Duplicate transaction" error. So i will stick with it.
     
    Last edited: Jun 26, 2020
  22. AakashDP

    AakashDP

    Joined:
    Nov 22, 2016
    Posts:
    11
    It is possible to get around the Restoring issue with 1.23.2. When you try to purchase a non consumable which is already bought on another device, you will get the DuplicateTransaction error and
    OnPurchaseFailed will be called in your IStoreListener. Immediately after that, the products from Google are refreshed and ProcessPurchase will be called for you to finish off the Purchase for that "failed" product. So in your code you could ignore your logic which runs when a purchase fails if you get the DuplicateTransaction error since ProcessPurchase will be called right after that.

    Kinda weird though that Unity will tell us that the Purchase failed only to tell us right afterwards that it succeeds.
     
  23. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,471
    No, do not follow this flow, a transaction should never call both OnPurchaseFailed and ProcessPurchase. IAP 1.23.2 appears to behave this way, it's a bug if so.
     
  24. AakashDP

    AakashDP

    Joined:
    Nov 22, 2016
    Posts:
    11
    The Changelog for 1.23.2 states that OnPurchaseFailed and ProcessPurchase will be called if there is a DuplicateTransaction:

    "GooglePlay - After the purchasing dialog, "You already own this product" from Google Play is shown, the IStoreListener.OnPurchaseFailed API is calls with an error of PurchaseFailureReason.DuplicateTransaction.
    • Unity IAP now treats "You already own this product" as a successful purchase, and also calls IStoreListener.ProcessPurchase. Note: This amends the related behavior introduced in 1.23.1."
    Of course it would be a lot better if just ProcessPurchase was called :D. Any idea on when this "bug" which causes both OnPurchaseFailed & ProcessPurchase to be triggered can be fixed @JeffDUnity3D ?
     
  25. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,471
    Hopefully this week.
     
  26. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    190
    If this a bug, what is intended behaviour? To send only OnPurchaseFailed or only ProcessPurchase?
    I hope it's ProcessPurchase, cause i dreamed for Apple-like behaviour for the long time. Apple can in the flow of the purchase say "You already bought this content" and then process it as purchase restore, but Google were just showing DuplicateTransaction error without restoring.
     
    Last edited: Jun 30, 2020
    AakashDP likes this.
  27. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,471
    The expected behavior if the user installs the app on a second Android device, ProcessPurchase would be called for subscriptions upon initialization. On iOS, when the user manually initiates the Restore, the same for non-consumables and subscriptions. We are a pass through service for the store APIs, in general we can't add specific behaviors on top of them, but occasionally we can leverage their additional query methods. Each store has a different restore process and offline behavior.
     
  28. AakashDP

    AakashDP

    Joined:
    Nov 22, 2016
    Posts:
    11
    Just checked in 1.23.3, there doesn't seem to be any change, however my aforementioned workaround which only works because of a "bug" in the plugin still works
     
  29. GMDdesign

    GMDdesign

    Joined:
    Mar 30, 2020
    Posts:
    10
    Hello! I have some problem. In my console i dont see any errors. I can't save my non consumable purchases in local Android device after restart. In IAP have any function to fix this?
    On Google server purchases saved ok. After reinstal app i can use purchases again before the first close.
    I use IAP Codeless.
     
  30. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,471
    Can you elaborate? What do you mean "can't save my non-consumable purchases". On a normal game restart, there should be no ProcessProcess calls. We don't save that information for you. This thread refers to installing the game on a second Android device which causes problems. But restore works as expected on the same device, but only when you reinstall the game, not at each app launch.
     
    AakashDP likes this.
  31. GMDdesign

    GMDdesign

    Joined:
    Mar 30, 2020
    Posts:
    10
    Oh.. ok, sorry. You all understood correctly. Thanks.
     
  32. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    190
    Hi Jeff,

    Can you explain the changes in 1.23.3?
    I am reading store description for the third time and it still escapes me somehow.
    I believe it's something to fix issues introduced in 1.23.2 and still don't address restore issue?
    Issues in 1.23.2 with "receiving multiple products for single purchase" - is it for consumables only? If i don't use consumables, it won't affect my players?
    How exactly the game will behave on DuplicateTransaction now? As mentioned before, in 1.23.2 it invoked both OnPurchaseFailed and ProcessPurchase, but what about now?
     
  33. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,471
    No it does not address the restore issue. You will only receive the DuplicateTransaction error code as previously
     
  34. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    190
    Should i update if i don't use consumables? This "erratic" behaviour is rather useful for me, and i don't see downsides (are any?) if i don't use consumables.
     
  35. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,471
    If it's working for you, then perhaps no need to upgrade.
     
  36. nicholasr

    nicholasr

    Unity Technologies

    Joined:
    Aug 15, 2015
    Posts:
    124
    Hi @Lisan for information sharing's sake about dupes, and probably not likely to resolve the "restoration across devices issue" being discussed in this thread:

    Building on @JeffDUnity3D 's explanation about DuplicateTransaction in 1.23.2 when a new DuplicateTransaction status is encountered for Google Play (6: RESPONSE_RESULT_ERROR) the code now performs a lightweight reconciliation, attempting to convert this error into a success. If the game sees a ProcessPurchase callback then the reconciliation found an outstanding "owned" record for this product, and there will be no further callbacks about that purchase unless the game does not "Complete" or "Confirm" the purchase.

    And as Jeff says 1.23.3 merely fixes one of the 1.23.2 features to be "opt-in" instead of always enabled, for compatibility's sake.
     
unityunity