Search Unity

IAP restore issues (Android)

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

  1. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    I would test with IAP 1.19, I would expect Restore to work in that version. We are hoping to release an IAP version that works with Unity 2019 in about a month, hopefully.
     
  2. DanWeston

    DanWeston

    Joined:
    Sep 9, 2014
    Posts:
    24
    Thank you for the update, I will see about giving 1.19 ago later next week!
     
    justinbartoo likes this.
  3. xmarleauFFG

    xmarleauFFG

    Joined:
    Mar 28, 2017
    Posts:
    3
    @JeffDUnity3D After downgrading from Unity Purchasing 1.22 to 1.18, both bugs are still happening for me.
    • The bug that everyone else have, which IAP aren't restored on other devices with the same account.
    • My own bug, where a low percentage of users have to buy the DLC again every time the app is closed.
    Did you have time to look at the requested code I sent you?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    Yes, this is an issue that we are working on. I haven't received any code. If this is in your code, then you are likely not doing anything incorrectly. This thread is discussing IAP restore.
     
  5. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    169
    Any news?
    It was "likely a month or so out." at August 1st, when i joined the thread.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    We found additional issues that need to be addressed, current estimated time frame is end of September for the next release.
     
    justinbartoo likes this.
  7. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    169
    End of September is good news. Just one thing to be sure - it will be update for iAp package itself, so the fix will work regardless of Unity version? Cause our main game is in Unity 2017.4.32, and game currently in testing for release in 2018.4.8
     
  8. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    Not editor version related, it's the IAP package itself, so you're good.
     
    justinbartoo likes this.
  9. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    169
    Great!
     
  10. pertz

    pertz

    Joined:
    Jan 8, 2015
    Posts:
    93
    Any news on the IAP fix date?
     
    kedronic, millar5001 and justinbartoo like this.
  11. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    We will know about the release date this week.
     
  12. prawn-star

    prawn-star

    Joined:
    Nov 21, 2012
    Posts:
    40
    Rolling back to IAP 1.16.0 does not seem to fix the issue
    I noticed that if a device has bought the product then when I re-install the app ProcessPurchase gets called after OnInitialized.

    If I install the app on a different device then only OnInitialized gets called

    Any news on the release date that will sort this issue??
     
    Last edited: Oct 3, 2019
  13. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    169
    This week is about to end soon.
    I need to know, should i release update with bugfixes now, or wait for iAP update, if it will be soon.
     
  14. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    We are on track to release within a week now. It is difficult to estimate a release date since issues may arise during testing.
     
  15. Nadan

    Nadan

    Joined:
    Jan 20, 2013
    Posts:
    341
    Hi,

    I'm also getting messages from customers that IAP aren't restored when the user has a new phone and reinstalled the game. I am using Unity IAP package (1.22.0). So this could be fixed just by reinstalling new Unity IAP when the fix arrives?
     
  16. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    Yes, this should be addressed in the upcoming release.
     
    Nadan likes this.
  17. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    342
    Android. I also got many users reports, that they don't have access to purchases after some app/closes. But i can't catch any issues on my 2 phones:1 with test account(android 10), 1 with regular(android 6). Both work well. Unity 2019.2.8f, latest IAP version. So i am waiting for release too =)
     
  18. pertz

    pertz

    Joined:
    Jan 8, 2015
    Posts:
    93
    News?

    I get *SEVERAL* complain emails per day. Please release the fix already. Any fix is better than current version, even if it doesnt completely work (!?)
     
  19. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    Are you referring to restore not working across devices? If so, this fix will be included in the next release which should be available any day now. It will be announced on the forum.
     
  20. pertz

    pertz

    Joined:
    Jan 8, 2015
    Posts:
    93
    I get several complains daily regarding IAP, it seems most of them (but not all) are related to the issue of this topic. Solving this will already help me go back to an acceptable number of complains.

    PS: the issue of closing the app using BACK button affected only a small part of the players and I had already "solved" that by disabling BACK to close a couple months ago, and now I have upgraded to Unity 2019.2.x which seems to solve that problem definitely.
     
    JeffDUnity3D likes this.
  21. nickpriore

    nickpriore

    Joined:
    Sep 8, 2015
    Posts:
    7
    Hi Jeff - are you referring to 2019.2.9 that just was released, or an update to the current IAP 2.0.6 version?
     
  22. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    The current version of IAP is 1.22, the next release is due out any day, and is what I'm referring to. From the Window menu, choose Unity IAP/IAP Updates... to see the version you are using. Note that IAP also requires a package too, but it doesn't change very often
     
    DanWeston likes this.
  23. nickpriore

    nickpriore

    Joined:
    Sep 8, 2015
    Posts:
    7
    Ah! 2.0.6 is the package version - got confused. But sounds good, will look for the IAP update. Thanks!
     
  24. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    169
    Hi Jeff,
    I see iAP 1.23.0 in the update window, but it doesn't say anything about fixing purchase restoring in release notes, why is that?
     
    DanWeston and pertz like this.
  25. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    109
    I was excited to try 1.23 since I've been sitting on an Android release for those fixes. The update failed, so let me know if I need to do the uninstall/reinstall thing.

    But so you see the errors:

    I first tried hitting the update button in the Services window (I'm currently on 1.20)

    That threw this error
    Code (CSharp):
    1. Reload Assembly called from managed code directly. This will cause a crash. You should never refresh assets in synchronous mode or enter playmode synchronously from script code.
    2. UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
    I restarted the Editor and got this error
    Code (CSharp):
    1. Error: Could not load signature of UnityEngine.Purchasing.UIFakeStore:GetOkayButton due to: Could not load file or assembly 'UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. assembly:UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null type:<unknown type> member:(null) signature:<none>
    2.  
    I then checked the Windows > IAP > Updates approach. The popup slowly populated but the Install button just took me to a blank MyAssets AssetStore page.

    Hope that helps

    Again, should I reinstall/install or try something else to get the latest?
     
    AtifatABS likes this.
  26. DanWeston

    DanWeston

    Joined:
    Sep 9, 2014
    Posts:
    24
    I've released a new build with the update, will hopefully start to see less complaints about restore not working!
     
  27. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    169
    You are risky guys. There was no message from Jeff here about this, 1.23 has nothing in release notes about this fix, and they even doesn't have anouncement in the iAP thread. I'll better wait for a confirmation.

    Update: now they do have anouncement, but still nothing about iAP restore there.
     
    Last edited: Oct 17, 2019
  28. pertz

    pertz

    Joined:
    Jan 8, 2015
    Posts:
    93
    Im also curious if this fixes or not the restore problem. Both the 1.23.0 and and the 1.22.1 notes dont mention anything about it.
     
  29. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    169
    Jeff, where are you?
     
  30. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    169
    Is anyone here can confirm, that he made testing and 1.23.0 fixed restoration issue?
     
  31. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    169
    Just cool.
    Nobody answering at all, i tried writing to Jeff, also to Nicolas (the one posted anouncement to the rood iAP thread) and no effect, everybody just silent.
     
    pertz likes this.
  32. Livealot

    Livealot

    Joined:
    Sep 2, 2013
    Posts:
    109
    Update on my attempts to update. I tried the uninstall/reinstall approach which did not recover the plugin to a workable state.

    Luckily I had git, so a reverted to before starting the update and started from the Asset Store vs. the Services Page. That worked as intended. Yay!

    Interestingly, if I go to the IAP Services page, it still wants to do an Update. If I go to File > Window > Unity IAP > IAP updates... the plugin correctly sees that I'm on 1.23 and don't need to update.

    So it seems like there is a hitch in the update logic if you start from the Services tab. And another hitch in the Services tab post-update. Hope that helps!
     
  33. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    Yes, Restore should be addressed in this release.
     
  34. Lisan

    Lisan

    Joined:
    Jun 17, 2009
    Posts:
    169
    What do you mean by "should"? "This release" is 1.23? Why restore not mentioned in release notes? It's major issue
     
  35. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    "Should" meaning yes we addressed it, it's working for me. So it should also work for you, please test. I will let the team know about the release notes, thanks for the heads up.
     
    DanWeston and pertz like this.
  36. prawn-star

    prawn-star

    Joined:
    Nov 21, 2012
    Posts:
    40
    Hi
    I'm still getting an issue with an in-app purchase not being recognised on different devices on Android?
    I'm testing an alpha build with a test card, always approves.
    This works great and I get an email for Google saying I have bought the product.
    Then when I build the app to a different device (using the same google play test account) It doesn't see that I have already purchased the product?

    Is there known limitations regarding test cards?

    I've double checked that I have V 1.23 (Window > Unity IAP > IAP Updates)
    In Packages though my In App Purchasing Version is 2.0.6

    Any help would be much appreciated.
     
  37. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    How are you debugging? What are you checking to see if the product was purchased?
     
  38. prawn-star

    prawn-star

    Joined:
    Nov 21, 2012
    Posts:
    40
    I have 2 devices, both signed into Google Play with the same account which is set up in the console to be a test account
    From Unity I build and run the app to both devices.
    S6 - Android 7.0
    S9 - Android 9
    On both devices I check to see the store controller product hasReceipt to see if it has one (through android studio and Debug.Log)

    BUT today the device (S9) that I purchased the product from yesterday, is now saying that I don't have a receipt for that product.
    I know I purchased the product because Google sent me an email saying I had.

    Are non consumable test purchases being reset now by Google? Like test subscriptions do after 1/2 an hour?

    UPDATE: I waited a couple of hours and the purchase has reset again. Says no receipt. I can see receipts from other products I have created while testing, but my latest version has been removed again
     
    Last edited: Oct 25, 2019
  39. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    Would need to see the device logs
     
  40. prawn-star

    prawn-star

    Joined:
    Nov 21, 2012
    Posts:
    40
    Are you talking about just the logs when the app is opened or the entire device?
    How do I get these and what is the best way to get these to you?

    I've also just noticed the Unity Analytics are logging my test purchases with real money?
     
  41. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    Start the adb logcat process on your PC with the device attached by USB, then launch the app. https://forum.unity.com/threads/how-to-capturing-device-logs-on-android.528680/ Yes, we log test purchases as verified revenue.
     
  42. nickpriore

    nickpriore

    Joined:
    Sep 8, 2015
    Posts:
    7
    If it means anything - my users are reporting that cross-device restores are working as intended now - updated to IAP v1.23
     
    JeffDUnity3D likes this.
  43. prawn-star

    prawn-star

    Joined:
    Nov 21, 2012
    Posts:
    40
    O.k so I left it over the weekend and have come in Monday and deleted the app from 3 different devices running Android 7,8 and 9 logged into the same GPlay testing account
    I build and run the app to all 3 devices and I can now confirm that the purchases are consistent across ALL 3 devices and ALL are referencing the same GPA order number now.

    Not sure why it wasn't working for me Friday, but all seems good now

    Cheers
     
  44. prawn-star

    prawn-star

    Joined:
    Nov 21, 2012
    Posts:
    40
    Hmmm spoke to soon

    I made another IAP on google play for testing purpose.
    Once again I needed to buy it individually on 3 different devices all logged into the same test account.
    And Google Play has sent me three emails for the same product with different GPA Order numbers.
    Is anyone else getting issues with Test Purchases on Android?
     
    Last edited: Oct 30, 2019
  45. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    Please show the device logs. What type of product is it? The same user cannot buy two non-consumables or subscriptions across separate devices, so this must be a consumable. Perhaps you mean that Restore is not occurring? A user can buy as many consumables as they want, on a single device or multiple devices, so this is likely expected behavior.
     
  46. Nananaaa

    Nananaaa

    Joined:
    Jul 24, 2016
    Posts:
    29
    Unfortunately the issue still persists:
    1. A NonConsumable product is bought in a build using Unity 2019.2.9, IAP package 2.0.6 and Unity IAP asset 1.22.0 (This version is currently on Google Play).
    2. A development build, installed on a second Android device, using Unity 2019.2.10, IAP package 2.0.6 and Unity IAP asset 1.23.0 doesn't see the purchase.
    The dev build prints the following during startup:
    2019/10/30 14:23:30.298 513 530 Info UnityIAP: Starting in-app billing setup.
    2019/10/30 14:23:30.318 513 513 Info UnityIAP: Billing service connected.
    2019/10/30 14:23:30.320 513 614 Info UnityIAP: invoking callback
    2019/10/30 14:23:30.320 513 614 Info UnityIAP: Checking for in-app billing 3 support.
    2019/10/30 14:23:30.330 513 614 Info UnityIAP: In-app billing version 3 supported for com.whatever.app
    2019/10/30 14:23:30.338 513 614 Info UnityIAP: Subscriptions AVAILABLE.
    2019/10/30 14:23:30.345 513 614 Info UnityIAP: Subscription upgrade and downgrade are AVAILABLE.
    2019/10/30 14:23:30.350 513 614 Info UnityIAP: Subscriptions information parse AVAILABLE.
    2019/10/30 14:23:30.363 513 614 Info UnityIAP: VR supported.
    2019/10/30 14:23:30.364 513 614 Info UnityIAP: onIabSetupFinished: 0
    2019/10/30 14:23:30.365 513 614 Info UnityIAP: Requesting 4 products
    2019/10/30 14:23:30.365 513 614 Info UnityIAP: QueryInventory: 4
    2019/10/30 14:23:30.365 513 614 Info UnityIAP: invoking callback
    2019/10/30 14:23:30.366 513 614 Info UnityIAP: Querying owned items, item type: inapp
    2019/10/30 14:23:30.366 513 614 Info UnityIAP: Package name: com.whatever.app
    2019/10/30 14:23:30.366 513 614 Info UnityIAP: Calling getPurchases with continuation token: null
    2019/10/30 14:23:30.378 513 614 Info UnityIAP: Owned items response: 0
    2019/10/30 14:23:30.378 513 614 Info UnityIAP: Continuation token: null
    2019/10/30 14:23:30.378 513 614 Info UnityIAP: Querying SKU details.
    2019/10/30 14:23:30.404 513 614 Info UnityIAP: Querying owned items, item type: subs
    2019/10/30 14:23:30.404 513 614 Info UnityIAP: Package name: com.whatever.app
    2019/10/30 14:23:30.404 513 614 Info UnityIAP: Calling getPurchases with continuation token: null
    2019/10/30 14:23:30.411 513 614 Info UnityIAP: Owned items response: 0
    2019/10/30 14:23:30.412 513 614 Info UnityIAP: Continuation token: null
    2019/10/30 14:23:30.412 513 614 Info UnityIAP: Querying SKU details.
    2019/10/30 14:23:30.437 513 614 Info UnityIAP: Querying owned items' purchase history, item type: subs
    2019/10/30 14:23:30.437 513 614 Info UnityIAP: Package name: com.whatever.app
    2019/10/30 14:23:30.437 513 614 Info UnityIAP: Calling getPurchaseHistory with continuation token: null
    2019/10/30 14:23:30.867 513 614 Info UnityIAP: Purchase history response: 0
    2019/10/30 14:23:30.868 513 614 Info UnityIAP: Continuation token: null
    2019/10/30 14:23:30.868 513 614 Info UnityIAP: Querying owned items' purchase history, item type: inapp
    2019/10/30 14:23:30.868 513 614 Info UnityIAP: Package name: com.whatever.app
    2019/10/30 14:23:30.868 513 614 Info UnityIAP: Calling getPurchaseHistory with continuation token: null
    2019/10/30 14:23:31.016 513 614 Info UnityIAP: Purchase history response: 0
    2019/10/30 14:23:31.022 513 614 Info UnityIAP: Continuation token: null
    2019/10/30 14:23:31.023 513 614 Info UnityIAP: onQueryInventoryFinished: true
    2019/10/30 14:23:31.023 513 614 Info UnityIAP: Inventory refresh successful. (response: 0:OK)
    2019/10/30 14:23:31.068 513 614 Info UnityIAP: invoking callback

    (These are from the dev builds first start)

    Log output of the published version is similar, except the one additional ("Sku is owned...") line at the bottom:
    2019-10-30 14:32:20.652 7934-7998/? I/UnityIAP: Querying owned items, item type: inapp
    2019-10-30 14:32:20.652 7934-7998/? I/UnityIAP: Package name: com.whatever.app
    2019-10-30 14:32:20.652 7934-7998/? I/UnityIAP: Calling getPurchases with continuation token: null
    2019-10-30 14:32:20.656 7934-7998/? I/UnityIAP: Owned items response: 0
    2019-10-30 14:32:20.656 7934-7998/? I/UnityIAP: Sku is owned: com.whatever.app.productname


    It seems like IAP asset 1.23.0 is still unable to see any previous purchases for other devices.

    Any ideas how to fix or workaround this are **VERY** welcome.
    Thank you.
     
  47. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    Package name is com.whatever.app and your product name is actually "productname"? Please show the code that you are using to initialize IAP and purchase products. Regardless if they show up or not, being able to purchase them again would not be possible, this is enforced by respective stores, not us. Ensure that the same user is logged into Google Play on each of the devices. Also, please test by making a purchase with 1.23 on one device, then install the app on a second device, also using 1.23. I would not expect purchases from previous versions to go missing. Keep in mind, adding an "Email" account on the device is not sufficient, the device profile must be under the same user. Checking the Google Play login will confirm, on the device.
     
  48. Nananaaa

    Nananaaa

    Joined:
    Jul 24, 2016
    Posts:
    29
    Dear @JeffDUnity3D

    Thank you for the quick response. Much appreciated!

    No, they have been replaced as I don't want to talk about the product here. Sorry for that.

    ---
    If it's really needed I'll prepare the code tomorrow. See, the point is that the receipts/orders ain't received on any device other than the one at which the purchase was made, so I doubt it's a bug in the implementation. Let me know if you really need it.

    ---
    That would be the intended behavior, yes. But it isn't. These are the steps to reproduce it:
    1. ProductType.NonConsumable must be changed to ProductType.Consumable.
    2. Then the app needs to be build and started on each involved device, which will consume the purchase.
    3. After that, ProductType needs to be changed back to NonConsumable and the app needs to be built and started again.
    4. Now we're back at the original problem:
      • The NonConsumable product isn't picked up by any other devices except the one at which it was bought.
      • Uninstalling and reinstalling the app on the device that made the purchase, will work. I.e. the purchase is restored.
      • You can happily purchase the same NonConsumable item on any device. Which doesn't make the customers that happy... ;)

    ---
    Verified. Both devices are logged in to the same Google account. The Play Store app shows on both devices the purchases made from both devices. The list is identical with the orders shown at Google Play Console under "Order management". The timestamps clearly show that the item was purchased multiple times.

    ---
    Done. Same behavior. See two quotes above.

    ---
    It doesn't look like the previous purchases went lost, because restoring the IAP works flawlessly after reinstalling the app on the device that made the purchase. It rather looks like previous purchases are only served to the one device that made the purchase.
    About the accounts: They are set up correctly. See above.


    So obviously, something's not right here...


    Two more things that could be relevant:
    1. The purchase is made using the "Test card, always approves" credit card. Could that be an issue?
    2. Knowing that a NonConsumeable can only be bought once, I've temporarily changed it to ProductType.Consumable. Maybe that messed something up?!?


    And two more question:
    1. When Unity IAP queries the receipts, do they come directly from Google Play or do they come from the Unity servers? If they come from the Unity servers, maybe the issue lays there. As already mentioned, it looks like the receipts are only served to the device that made the purchase. Which of course does not explain why a NonConsumable can be bought twice. Maybe we're looking at two different issues here.
    2. Assuming that the issue is fixed in 1.23, could it be that some files are cached in the background?


    Again, thank you for your help in that matter.
    All the best,
    Michael.
     
  49. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    6,511
    I don't follow. You purposely change the product type after a user purchases it, create a new build, make the purchase again, and then change the product type back, and create another build? This clearly would not happen in the real world, you should never change the product after a user buys it! Receipts come directly from the stores, not Unity. There is no caching. Please share the code and device logs. The device logs will confirm the IAP version, this was fixed in 1.23. We are just guessing otherwise. We don't enforce the fact that non-consumables can't be repurchased (or can, in your case). You would need to bring up your issue with the respective stores, I suspect the same would occur in native code. I'm sure Apple and Google would be most concerned and interested if you found a way for a user to purchase multiple non-consumables or subscriptions.
     
  50. prawn-star

    prawn-star

    Joined:
    Nov 21, 2012
    Posts:
    40
    Google Play Console does not have an option for consumable or non-consumable.
    In Unity I add the product to the builder as a ProductType.NonConsumable.

    Below are parts of email receipts FROM Google.
    Same product bought on different devices, using the same google play account.

    It seems like it takes about a day for the receipt to propagate as my 3 test devices are all recognising the product as purchased with the same Order Number GPA number today.
    Which happens to be the last one generated from the multiple purchases yesterday.

    1)
    Order number: GPA.3379-3122-9069-67593
    Order date: 30/10/2019 1:52:11 PM

    Item Price

    Pompeii (Pompeii VR) $2.99

    2)
    Order number: GPA.3358-9164-7894-56849
    Order date: 30/10/2019 3:03:20 PM

    Item Price

    Pompeii (Pompeii VR) $2.99
     
    Last edited: Oct 30, 2019
    Nananaaa likes this.
unityunity