Search Unity

IAP Restore - Android

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

  1. a_deo_et_rege

    a_deo_et_rege

    Joined:
    Jun 13, 2017
    Posts:
    13
    I have used Unity's codeless IAP and set up consumable and non consumable products, all work when testing via google play on an android device.

    The non consumable items cannot be purchased again once they have been bought, the purchase fails.
    I guess this is google saying you have already bough the product.

    I am aware of the restore function in the codeless IAP but i am not certain how this works, my non consumable items are setup so a boolean is set to true once purchased. I am looking for a way to reinstate the boolean values if there has been a reinstall.

    I think because my non-consumables are set up via variables when reinstalling they are not restoring the variable values and working, although google does seem to pick up they have been purchased.

    I want to be able to read if the item has been purchased and then take action to set up the variable as true so the non consumable will be active when the user reinstalls.

    Any help or advice would be greatly appreciated, I am not a coder so simple explanations would be brilliant!! :)
     
  2. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @a_deo_et_rege

    This is expected behavior for Unity IAP, although technically, Google Play doesn't have the concept of Non-Consumable.

    You actually don't even need to use the Restore option in Codeless IAP. Restoration of Non-Consumable products happens automatically on Google Play.

    After you re-install, Unity IAP will check with Google Play to see if you are entitled to any of the products you have added to your Catalog. If you are, then Unity IAP will call ProcessPurchase for each of the products that need to be Restored.

    So whatever you are using in your ProcessPurchase callback will be the same for a new purchase and a restored process.

    However, it is important to note that this happens as soon as the app is started. So you will need to be ready to fulfill your purchases as soon as your app starts.

    If your Purchasing UI is not ready, you can use the IAP Listener that was added recently. It works similar to Codeless IAP, but it doesn't have any UI associated with it. It simply has the callbacks.
    https://docs.unity3d.com/Manual/UnityIAPCodelessIAP.html
     
  3. a_deo_et_rege

    a_deo_et_rege

    Joined:
    Jun 13, 2017
    Posts:
    13
    On reinstalling the game, the Boolean for show no ads is not set back to true? I have monitored this and it doesn't seem to be setting it back.

    I think i could do this in code though, i suspect from what you have mentioned it would be through ProcessPurchase.

    So id check if the item has been purchased and reinstate the relevant variables.

    Are the any simple code tutorials that you can recommend that would help with this??

    Thanks for taking the time to reply its appreciated.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @a_deo_et_rege What Boolean value are you referring to? Can you show your code, and a screenshot of your Inspector for your IAPButton settings.
     
    Soternicus likes this.
  5. a_deo_et_rege

    a_deo_et_rege

    Joined:
    Jun 13, 2017
    Posts:
    13
    Hi Jeff sorry for the late reply, this may be an issue as i am using a plugin called Fungus for unity as a non coder this is easier to help me develop in unity than programming. This works on flow charts and blocks were you put the code.

    Link to Asset Store
    https://assetstore.unity.com/packages/templates/systems/fungus-34184

    The code less IAP buttons on fail and completion fire to 2 different blocks and the booleans are set up and controlled within fungus.
    IE if don't show ads boolean is true - Dont show ads etc

    If i can get a script that checks if the items have been purchased I sort of know how to code this into fungus or at least to return in fungus what is required. So if the no ads had been purchased and this with some coding came back as true I can then direct it to fungus to do the required setting of the boolean.

    Sorry i am not very coding orientated, if you would still like to see the buttons and screen shots happy to do so, the whole thing seems to work at least with test purchases but it doesn't as mentioned reinstate any non consumables.

    thanks again for your time and patientce
     
  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Unfortunately I'm not familiar with Fungus nor could we offer specific support. In your case, we don't currently offer inventory management, but is something we are considering for a future release. In the meantime, you would want to persist the purchase information locally and set the Boolean values accordingly at startup. Be sure to test during uninstall/reinstall. You would want to check with Fungus how they would recommend persisting data between sessions, and persist the value in the IAP button purchase success.
     
  7. Sparkline

    Sparkline

    Joined:
    Feb 8, 2013
    Posts:
    121
    Unity 2018.2.11f
    Restore purchase don't work for nonConsumeable product in Android.
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)

    This function wont call, but should. Any suggesions?

    UnityIAP logs:
    Code (CSharp):
    1. 11-02 12:03:30.512: I/UnityIAP(7336): Inventory refresh successful. (response: 0:OK)
    2. 11-02 12:03:30.512: I/UnityIAP(7336): The number of owned skus is0
    3. 11-02 12:03:30.512: I/UnityIAP(7336): The number of purchased skus is1
    4. 11-02 12:03:30.512: I/UnityIAP(7336): The number of subscriptions purchased history is0
    5. 11-02 12:03:30.569: I/UnityIAP(7336): Finish transaction:GPA.3350-5197-4664-50581
    6.  
     
    BAIZOR and 5argon like this.
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @Sparkline Android does not have a Restore purchase method. It happens on reinstall only. Please see the post on June 21 from ap-unity. Please provide steps to reproduce in your situation, and the code that you are using.
     
  9. Sparkline

    Sparkline

    Joined:
    Feb 8, 2013
    Posts:
    121
    Yes I mean reinstall. As I understand: After reinstall system checks if account has purchased items and if it get some it fires ProcessPurchase function.
    So in my case system see 1 paid sku but wont fire this function. My code is taken from here https://unity3d.com/ru/learn/tutorials/topics/ads-analytics/integrating-unity-iap-your-game
    I have only 1 nonconsumeable product.
     
  10. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    How did you define the product as non-consumable, please show your specific code. Also, what version of IAP are you using?
     
  11. Daahrien

    Daahrien

    Joined:
    Dec 5, 2016
    Posts:
    100
  12. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @Zoryth You need to handle inventory management yourself, but is a feature we are considering for a future release. You can use PlayerPrefs to store purchase information, but it has limitations. Restore only happens with non-consumables and subscriptions during reinstall.
     
  13. rahul_noob

    rahul_noob

    Joined:
    Oct 3, 2017
    Posts:
    26
    Hi @JeffDUnity3D, Android just started their restore feature on April 15. Don't I have any other option to restore the subscription from anytime I want? like iOS?. Android Have a 'getPurchase()' method to get the purchase status manually at any time.
     
    Last edited: Apr 19, 2019
  14. hsallander

    hsallander

    Joined:
    Dec 19, 2013
    Posts:
    46
    Hi all!

    @JeffDUnity3D (and anyone else with knowledge about this kind of issue), we have a couple of freemium apps, with a single IAP available in each to unlock the full version, and we're having problems with the users not being able to restore the fullversion-iap after they've restored their devices from a backup. The encrypted info we've stored in PlayerPrefs then isn't valid because the unique ID of the device has changed so the purchase has to be restored in order to unlock it again, but it seems the app already has stored some internal information at that point (info following the backup restored version of the app) that it has already done the initial purchase call so PurchaseProcessingResult() won't be called automatically again.

    Looking at the adb logcat I can see the following:
    Normally, when the restore is working, the call to
    OnInitialized(IStoreController c, IExtensionProvider e) 
    is followed by a call to
    PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    and this follows in the log
    UnityIAP: Finish transaction:GPA.***


    But in the case of the backup-restored apps the OnInitialized is instead followed by a
    Unity   : Already recorded transaction GPA.*** 
    and then the
    UnityIAP: Finish transaction:GPA.***

    and as you can see, no call to PurchaseProcessingResult in between.

    Is there a way to intercept the call causing the
    Unity   : Already recorded transaction GPA.*** 
    output and handle the receipt data there? Or if not, is it possible to query the Google Play store through the UnityIAP lib to get the receipt of previous purchases to manually process them and unlock the app again?


    Asking the users to delete and reinstall the app has been our approach up until now, but this is not an ideal solution due to:
    1. Many of our android users seem to now grasp what it means to do a full uninstall of the app, and instead just end up deleting it from the launcher homescreen, which doesn't solve the issue, causing confusion and frustration
    2. Deleting the app obviously makes them loose all their data and stuff built in the apps, progress etc is lost.
     
  15. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Did this just start occurring with IAP 1.22? Only non-consumables and subscriptions would be expected to Restore upon reinstall. But Restore does look to be affected in 1.22 regardless, and we are continuing to investigate.
     
  16. hsallander

    hsallander

    Joined:
    Dec 19, 2013
    Posts:
    46
    Yes we're talking non-consumables (unlock the full version of the game, one-time purchase). We're currently on an older version of the Unity IAP lib, 1.19.0
     
  17. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Android Restore only happens upon actual uninstall/reinstall. Often studios will save user info to the cloud, instead of PlayerPrefs, so the data is available across devices and platforms.
     
  18. hsallander

    hsallander

    Joined:
    Dec 19, 2013
    Posts:
    46
    We don't use logins (we mainly do kids games) so I don't think we can store it in a cloud service and therefor we have to store it locally. So I think either we can change to storing it in a non-device-specific encryption which would allow the users to just copy the storage blob to another device and still run it (with the copy/piracy implications that will have), or we get the restore via Google Play to work properly. We're getting these support messages from older apps as well that are using UnityIAP 1.15.0, that when they restore the device (or setup a new one) from a backup, uninstall the app and install it again, the restore function in the android app isn't called so they're not able to restore the purchase.

    I see in the release notes for 1.22.0 that there's a new method to manually call the restore method on Android but I'm also reading you've detected some problems with it. Do you think it's safe to go ahead and upgrade to 1.22.0 and manually call initiate the restore, or are you guys close to finding a fix for the error you've found?
     
  19. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    There should be no issues with Restore on versions of IAP prior to 1.22 when coded correctly. The Sample IAP project on this forum works without issue during restore. I would wait to test with 1.22, it does have some issues with Restore.
     
  20. hippogames

    hippogames

    Joined:
    Feb 5, 2015
    Posts:
    233
    Hi there! In my app ProcessPurchase is also not called after app reinstall. I'm on Unity 2018.4 with updated IAP. I have to make Restore button that simply tries to purchase again. In case of already owned item I consider that restore is succeeded. Anyway, some debug/check steps can be helpful because I even don't know where to start. Codeless IAP is cool thing, but Restore feature should work clear. At least work)
     
  21. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Understood, please see my previous post for a work around.
     
  22. OneManEscapePlan

    OneManEscapePlan

    Joined:
    Oct 14, 2015
    Posts:
    222
    For those of us who are getting IAP from the package manager, what package manager version corresponds to 1.22?
     
  23. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You need both the Purchasing package in Package Manager, and the Asset package too. Unfortunately there are wider issues with IAP on Unity 2019, as mentioned on other posts here.
     
  24. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We have just confirmed here that Android Restore works as expected without issue, also in 1.22. Upon app reinstall after having previously purchased a non-consumable, process purchase is triggered. If you are using Codeless, they you will need an IAP Listener. Please see the sample projects here: https://forum.unity.com/threads/sample-iap-project.529555/
     
  25. Divinitize1

    Divinitize1

    Joined:
    May 27, 2019
    Posts:
    101
    Can anyone confirm that the Restore happens on Android even in Alpha and Beta private builds with test purchases? because my remove ads test isn't restoring on startup at the moment.

    [EDIT]
    I thought I figured it out with the listener, I don't know if I'm being stupid or if the docs are confusing but the Listener is so very confusing to me.
    I added the listener to my main scene and linked the success to my Remove Ads function.
    It wasn't being called by default which is good, however, it's not also being called when I buy another IAP that is consumable.

    Someone even mentioned on this thread that the Android restore is automatic, but it isn't working for me, I even added the restore button as it's needed for Apple anyway but that doesn't even work on android.

    any tips?
     
    Last edited: Jun 18, 2019
  26. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Use the Sample IAP project as an example. And as always, provide the device logs. They will show if IAP initialization failed, or the purchase failed, version info, etc. https://forum.unity.com/threads/how-to-capturing-device-logs-on-android.528680/
     
  27. Divinitize1

    Divinitize1

    Joined:
    May 27, 2019
    Posts:
    101
    I have tried the sample project with 2019.1.6f1

    and am getting errors
    C:/Users/Me/Desktop/IAP_Project/PureRockets_IAP/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/FastAction.cs(24,45): error CS1644: Feature `out variable declaration' cannot be used because it is not part of the C# 4.0 language specification
     
  28. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Separate issue, please see the posts here on the forum with regard to Unity 2019 . But in this case, I believe you simply need to update the packages. Easiest might be (make a back up first, of course) is to use Help/Reset Packages to Default.
     
  29. Divinitize1

    Divinitize1

    Joined:
    May 27, 2019
    Posts:
    101

    Right here is an update, still cannot seem to get my restore for blocked ads to work on android.
    I am using an Alpha/Beta build for Google play.
    I don't have an IAP listener in my scene because frankly, it's the most confusing thing I've tried to implement in my game so far. the only time I got it to do anything it was duplicating purchases, I read that it's not needed if your IAP buttons are on the same scene so I just removed it.
    I also just want to mention that my IAP buttons are on a hidden canvas until the store is opened if that's an issue.

    Managed to get some logs if anyone can help.

    My product is called "premoveads" which I can see on this list.
    Also, IGNORE the error regarding missing product id, I missed adding one for a different purchase when I uploaded my new test app to the store.
    Also, the very last call is when I pressed the Restore button I have which I know doesn't work for android.

    Code (CSharp):
    1. 06-19 01:21:23.258 19959 19976 I UnityIAP: Starting in-app billing setup.
    2. 06-19 01:21:23.283 19959 19959 I UnityIAP: Billing service connected.
    3. 06-19 01:21:23.285 19959 20047 I UnityIAP: invoking callback
    4. 06-19 01:21:23.286 19959 20047 I UnityIAP: Checking for in-app billing 3 support.
    5. 06-19 01:21:23.323 19959 20047 I UnityIAP: In-app billing version 3 supported for com.MYCOMPANY.MYGAME
    6. 06-19 01:21:23.329 19959 20047 I UnityIAP: Subscriptions AVAILABLE.
    7. 06-19 01:21:23.334 19959 20047 I UnityIAP: Subscription upgrade and downgrade are AVAILABLE.
    8. 06-19 01:21:23.338 19959 20047 I UnityIAP: Subscriptions information parse AVAILABLE.
    9. 06-19 01:21:23.347 19959 20047 I UnityIAP: VR supported.
    10. 06-19 01:21:23.349 19959 20047 I UnityIAP: onIabSetupFinished: 0
    11. 06-19 01:21:23.349 19959 20047 I UnityIAP: Requesting 8 products
    12. 06-19 01:21:23.349 19959 20047 I UnityIAP: QueryInventory: 8
    13. 06-19 01:21:23.353 19959 20047 I UnityIAP: invoking callback
    14. 06-19 01:21:23.354 19959 20047 I UnityIAP: Querying owned items, item type: inapp
    15. 06-19 01:21:23.354 19959 20047 I UnityIAP: Package name: com.MYCOMPANY.MYGAME
    16. 06-19 01:21:23.354 19959 20047 I UnityIAP: Calling getPurchases with continuation token: null
    17. 06-19 01:21:23.361 19959 20047 I UnityIAP: Owned items response: 0
    18. 06-19 01:21:23.361 19959 20047 I UnityIAP: Sku is owned: premoveads
    19. 06-19 01:21:23.362 19959 20047 I UnityIAP: Continuation token: null
    20. 06-19 01:21:23.362 19959 20047 I UnityIAP: Querying SKU details.
    21. 06-19 01:21:23.400 19959 20047 I UnityIAP: Querying owned items, item type: subs
    22. 06-19 01:21:23.400 19959 20047 I UnityIAP: Package name: com.MYCOMPANY.MYGAME
    23. 06-19 01:21:23.400 19959 20047 I UnityIAP: Calling getPurchases with continuation token: null
    24. 06-19 01:21:23.700 19959 20047 I UnityIAP: Owned items response: 0
    25. 06-19 01:21:23.700 19959 20047 I UnityIAP: Continuation token: null
    26. 06-19 01:21:23.700 19959 20047 I UnityIAP: Querying SKU details.
    27. 06-19 01:21:23.706 19959 20047 I UnityIAP: Querying owned items' purchase history, item type: subs
    28. 06-19 01:21:23.706 19959 20047 I UnityIAP: Package name: com.MYCOMPANY.MYGAME
    29. 06-19 01:21:23.706 19959 20047 I UnityIAP: Calling getPurchaseHistory with continuation token: null
    30. 06-19 01:21:23.925 19959 20047 I UnityIAP: Purchase history response: 0
    31. 06-19 01:21:23.925 19959 20047 I UnityIAP: Continuation token: null
    32. 06-19 01:21:23.925 19959 20047 I UnityIAP: Querying owned items' purchase history, item type: inapp
    33. 06-19 01:21:23.925 19959 20047 I UnityIAP: Package name: com.MYCOMPANY.MYGAME
    34. 06-19 01:21:23.925 19959 20047 I UnityIAP: Calling getPurchaseHistory with continuation token: null
    35. 06-19 01:21:23.998 19959 20047 I UnityIAP: Purchase history response: 0
    36. 06-19 01:21:23.999 19959 20047 I UnityIAP: Continuation token: null
    37. 06-19 01:21:23.999 19959 20047 I UnityIAP: onQueryInventoryFinished: true
    38. 06-19 01:21:23.999 19959 20047 I UnityIAP: Inventory refresh successful. (response: 0:OK)
    39. 06-19 01:21:24.037 19959 20047 I UnityIAP: invoking callback
    40. 06-19 01:21:24.414 19959 20047 I UnityIAP: invoking callback
    41. 06-19 01:21:24.452 19959 19976 I Unity   : 1351.356166
    42. 06-19 01:21:24.452 19959 19976 I Unity   :  #0 0xc45ef0b0 (libunity.so) ? 0x42f0b0
    43. 06-19 01:21:24.452 19959 19976 I Unity   :  #1 0xc4cb1780 (libunity.so) ? 0xaf1780
    44. 06-19 01:21:24.452 19959 19976 I Unity   :  #2 0xc48884f0 (libunity.so) ? 0x6c84f0
    45. 06-19 01:21:24.452 19959 19976 I Unity   :  #3 0xc48883e8 (libunity.so) ? 0x6c83e8
    46. 06-19 01:21:24.452 19959 19976 I Unity   :
    47. 06-19 01:21:24.452 19959 19976 I Unity   : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 48)
    48. 06-19 01:21:24.452 19959 19976 I Unity   :
    49. 06-19 01:21:24.454 19959 19976 I Unity   : Coins to add - 0
    50. 06-19 01:21:24.454 19959 19976 I Unity   :  #0 0xc45ef0b0 (libunity.so) ? 0x42f0b0
    51. 06-19 01:21:24.454 19959 19976 I Unity   :  #1 0xc4cb1780 (libunity.so) ? 0xaf1780
    52. 06-19 01:21:24.454 19959 19976 I Unity   :  #2 0xc48884f0 (libunity.so) ? 0x6c84f0
    53. 06-19 01:21:24.454 19959 19976 I Unity   :  #3 0xc48883e8 (libunity.so) ? 0x6c83e8
    54. 06-19 01:21:24.454 19959 19976 I Unity   :
    55. 06-19 01:21:24.454 19959 19976 I Unity   : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 48)
    56. 06-19 01:21:24.454 19959 19976 I Unity   :
    57. 06-19 01:21:24.516 19959 19976 I Unity   : Already recorded transaction GPA.3386-4666-4614-70296
    58. 06-19 01:21:24.516 19959 19976 I Unity   :  #0 0xc45ef0b0 (libunity.so) ? 0x42f0b0
    59. 06-19 01:21:24.516 19959 19976 I Unity   :  #1 0xc4cb1780 (libunity.so) ? 0xaf1780
    60. 06-19 01:21:24.516 19959 19976 I Unity   :  #2 0xc48884f0 (libunity.so) ? 0x6c84f0
    61. 06-19 01:21:24.516 19959 19976 I Unity   :  #3 0xc48883e8 (libunity.so) ? 0x6c83e8
    62. 06-19 01:21:24.516 19959 19976 I Unity   :
    63. 06-19 01:21:24.516 19959 19976 I Unity   : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 48)
    64. 06-19 01:21:24.516 19959 19976 I Unity   :
    65. 06-19 01:21:24.519 19959 19976 I UnityIAP: Finish transaction:GPA.3386-4666-4614-70296
    66. 06-19 01:21:24.543 19959 19976 I Unity   : UnityIAP: Promo interface is available for 7 items
    67. 06-19 01:21:24.543 19959 19976 I Unity   :  #0 0xc45ef0b0 (libunity.so) ? 0x42f0b0
    68. 06-19 01:21:24.543 19959 19976 I Unity   :  #1 0xc4cb1780 (libunity.so) ? 0xaf1780
    69. 06-19 01:21:24.543 19959 19976 I Unity   :  #2 0xc48884f0 (libunity.so) ? 0x6c84f0
    70. 06-19 01:21:24.543 19959 19976 I Unity   :  #3 0xc48883e8 (libunity.so) ? 0x6c83e8
    71. 06-19 01:21:24.543 19959 19976 I Unity   :
    72. 06-19 01:21:24.543 19959 19976 I Unity   : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 48)
    73. 06-19 01:21:24.543 19959 19976 I Unity   :
    74. 06-19 01:21:24.712 19959 20047 I UnityIAP: invoking callback
    75. 06-19 01:21:25.021 19959 20047 I UnityIAP: invoking callback
    76. 06-19 01:21:25.221 19959 19959 D AdsUnity: Calling loadAd() on Android
    77. 06-19 01:21:25.298 19959 19959 D AdsUnity: Calling show() on Android
    78. 06-19 01:21:25.371 19959 20047 I UnityIAP: invoking callback
    79. 06-19 01:21:25.433  3639 21136 V WindowManager: Relayout Window{5e5c1c6d0 u0 com.MYCOMPANY.MYGAME/com.unity3d.player.UnityPlayerActivity}: viewVisibility=0 req=1440x2560 WM.LayoutParams{(0,0)(fillxfill) sim=#20 ty=1 fl=#80810500 pfl=0x20000 fmt=-3 wanim=0x1030465 vsysui=0x1706 sysuil=true needsMenuKey=2 naviIconColor=0}
    80. 06-19 01:21:25.458 19959 19959 D ViewRootImpl@17aff82[UnityPlayerActivity]: Relayout returned: oldFrame=[0,0][1440,2560] newFrame=[0,0][1440,2560] result=0x1 surface={isValid=true -1008783360} surfaceGenerationChanged=false
    81. 06-19 01:21:26.640 19959 19959 D ViewRootImpl@17aff82[UnityPlayerActivity]: ViewPostImeInputStage processPointer 0
    82. 06-19 01:21:26.775 19959 19959 D ViewRootImpl@17aff82[UnityPlayerActivity]: ViewPostImeInputStage processPointer 1
    83. 06-19 01:21:27.569 19959 19959 D AdsUnity: Calling show() on Android
    84. 06-19 01:21:29.619 19959 20305 I Unity   : HandleRewardedAdLoaded event received
    85. 06-19 01:21:29.619 19959 20305 I Unity   :  #0 0xc45ef0b0 (libunity.so) ? 0x42f0b0
    86. 06-19 01:21:29.619 19959 20305 I Unity   :  #1 0xc4cb1780 (libunity.so) ? 0xaf1780
    87. 06-19 01:21:29.619 19959 20305 I Unity   :  #2 0xc48884f0 (libunity.so) ? 0x6c84f0
    88. 06-19 01:21:29.619 19959 20305 I Unity   :  #3 0xc48883e8 (libunity.so) ? 0x6c83e8
    89. 06-19 01:21:29.619 19959 20305 I Unity   :
    90. 06-19 01:21:29.619 19959 20305 I Unity   : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 48)
    91. 06-19 01:21:29.619 19959 20305 I Unity   :
    92. 06-19 01:21:35.009 19959 19959 D ViewRootImpl@17aff82[UnityPlayerActivity]: ViewPostImeInputStage processPointer 0
    93. 06-19 01:21:35.065 19959 19959 D ViewRootImpl@17aff82[UnityPlayerActivity]: ViewPostImeInputStage processPointer 1
    94. 06-19 01:21:38.823 19959 19959 D ViewRootImpl@17aff82[UnityPlayerActivity]: ViewPostImeInputStage processPointer 0
    95. 06-19 01:21:38.891 19959 19959 D ViewRootImpl@17aff82[UnityPlayerActivity]: ViewPostImeInputStage processPointer 1
    96. 06-19 01:21:40.733 19959 19959 D ViewRootImpl@17aff82[UnityPlayerActivity]: ViewPostImeInputStage processPointer 0
    97. 06-19 01:21:40.801 19959 19959 D ViewRootImpl@17aff82[UnityPlayerActivity]: ViewPostImeInputStage processPointer 1
    98. 06-19 01:21:41.016 19959 19976 E Unity   : CodelessIAPStoreListener attempted to get unknown product
    99. 06-19 01:21:41.016 19959 19976 E Unity   :  #0 0xc45ef0b0 (libunity.so) ? 0x42f0b0
    100. 06-19 01:21:41.016 19959 19976 E Unity   :  #1 0xc4cb1780 (libunity.so) ? 0xaf1780
    101. 06-19 01:21:41.016 19959 19976 E Unity   :  #2 0xc48884f0 (libunity.so) ? 0x6c84f0
    102. 06-19 01:21:41.016 19959 19976 E Unity   :  #3 0xc48883e8 (libunity.so) ? 0x6c83e8
    103. 06-19 01:21:41.016 19959 19976 E Unity   :
    104. 06-19 01:21:41.016 19959 19976 E Unity   : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 48)
    105. 06-19 01:21:41.016 19959 19976 E Unity   :
    106. 06-19 01:21:41.022 19959 19976 E Unity   : IAPButton productId is empty
    107. 06-19 01:21:41.022 19959 19976 E Unity   :  #0 0xc45ef0b0 (libunity.so) ? 0x42f0b0
    108. 06-19 01:21:41.022 19959 19976 E Unity   :  #1 0xc4cb1780 (libunity.so) ? 0xaf1780
    109. 06-19 01:21:41.022 19959 19976 E Unity   :  #2 0xc48884f0 (libunity.so) ? 0x6c84f0
    110. 06-19 01:21:41.022 19959 19976 E Unity   :  #3 0xc48883e8 (libunity.so) ? 0x6c83e8
    111. 06-19 01:21:41.022 19959 19976 E Unity   :
    112. 06-19 01:21:41.022 19959 19976 E Unity   : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 48)
    113. 06-19 01:21:41.022 19959 19976 E Unity   :
    114. 06-19 01:21:41.022 19959 19976 W Unity   : The product catalog has no product with the ID ""
    115. 06-19 01:21:41.022 19959 19976 W Unity   :  #0 0xc45ef0b0 (libunity.so) ? 0x42f0b0
    116. 06-19 01:21:41.022 19959 19976 W Unity   :  #1 0xc4cb1780 (libunity.so) ? 0xaf1780
    117. 06-19 01:21:41.022 19959 19976 W Unity   :  #2 0xc48884f0 (libunity.so) ? 0x6c84f0
    118. 06-19 01:21:41.022 19959 19976 W Unity   :  #3 0xc48883e8 (libunity.so) ? 0x6c83e8
    119. 06-19 01:21:41.022 19959 19976 W Unity   :
    120. 06-19 01:21:41.022 19959 19976 W Unity   : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 48)
    121. 06-19 01:21:41.022 19959 19976 W Unity   :
    122. 06-19 01:21:59.420 19959 19959 D ViewRootImpl@17aff82[UnityPlayerActivity]: ViewPostImeInputStage processPointer 0
    123. 06-19 01:21:59.498 19959 19959 D ViewRootImpl@17aff82[UnityPlayerActivity]: ViewPostImeInputStage processPointer 1
    124. 06-19 01:21:59.676 19959 19976 W Unity   : Android is not a supported platform for the Codeless IAP restore button
    125. 06-19 01:21:59.676 19959 19976 W Unity   :  #0 0xc45ef0b0 (libunity.so) ? 0x42f0b0
    126. 06-19 01:21:59.676 19959 19976 W Unity   :  #1 0xc4cb1780 (libunity.so) ? 0xaf1780
    127. 06-19 01:21:59.676 19959 19976 W Unity   :  #2 0xc48884f0 (libunity.so) ? 0x6c84f0
    128. 06-19 01:21:59.676 19959 19976 W Unity   :  #3 0xc48883e8 (libunity.so) ? 0x6c83e8
    129. 06-19 01:21:59.676 19959 19976 W Unity   :
    130. 06-19 01:21:59.676 19959 19976 W Unity   : (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 48)
    131. 06-19 01:21:59.676 19959 19976 W Unity   :
     
  30. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    I might suggest trying with the scripted IAP sample project. From error in the logs, it looks like you don't have a product associated with your IAP button. If your canvas is hidden or similar, then you have two choices. Either use an IAP listener, or use scripting. And on Android, Restore only happens when you uninstall then reinstall the app.
     
  31. Divinitize1

    Divinitize1

    Joined:
    May 27, 2019
    Posts:
    101
    I appreciate the time you take to help us out and reply.
    I mentioned that the "no product associated with the button" problem was for a different button that I missed to add when I uploaded this version, that's since been fixed.
    I also mentioned that when I had the IAP listener all it was doing was calling whatever the purchasecomplete was set on it whenever I purchased anything at all, even other consumable products. The Documentation is not very easy to understand for it.
    I also read through the script of the sample project but also don't understand which function is acting as the "listener".

    Thanks for helping , really do appreciate it and sorry if i seem a little stressed its because i am :)
     
  32. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    There are two sample projects at that link, the first is the scripted version (which you want) and the second codeless, with a listener. I'm not a big fan of codeless because of issues just like you are having. Start with the first project, watch the video and chill!
     
  33. Divinitize1

    Divinitize1

    Joined:
    May 27, 2019
    Posts:
    101
    Ok, I've backed up my Codeless and am going to attempt converting to code to see if that fixes my issue.
    This is probably going to be another silly question but in the sample projects code, I can't for the life of me figure out where to actually reward the products after purchase complete?
    Can understand where to add the products etc, is it here?



    Code (CSharp):
    1.   public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    2.     {
    3.         test_product = args.purchasedProduct;
    4.  
    5.  
    6.  
    7.         //MyDebug(string.Format("ProcessPurchase: FAIL. Unrecognized product: '{0}'", args.purchasedProduct.definition.id));
    8.  
    9.         if (return_complete)
    10.         {
    11.             MyDebug(string.Format("ProcessPurchase: Complete. Product:" + args.purchasedProduct.definition.id + " - " + test_product.transactionID.ToString()));
    12.             return PurchaseProcessingResult.Complete;
    13.         }
    14.         else
    15.         {
    16.             MyDebug(string.Format("ProcessPurchase: Pending. Product:" + args.purchasedProduct.definition.id + " - " + test_product.transactionID.ToString()));
    17.             return PurchaseProcessingResult.Pending;
    18.         }
    19.  
    20.      }
    Just took a stab in the dark and this is giving me the results I'm after, I just want to make sure It's correct? :)

    Code (CSharp):
    1.         if(test_product.definition.id == "ID")
    2.         {
    3.           //DO STUFF HERE
    4.         }
     
    Last edited: Jun 19, 2019
  34. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    No, you'll want to use args.purchasedProduct. I wouldn't recommend to convert your code, first just get the Sample project working.
     
  35. Divinitize1

    Divinitize1

    Joined:
    May 27, 2019
    Posts:
    101
    It's all good, I actually converted to that script version from Codeless in about 20 mins and apart from what you just mentioned that ill try in a sec, everything including I'm happy to say Restoring is now working!.

    Could you give me an example of how to correctly check the product id from args.purchasedProduct?

    There's still a lot I need to learn regarding scripting in c#, and I haven't used anything using args before.
    It's just that "test_product.definition.id ==" is actually working even if it's incorrect.
    I presume looking at another post that I just use args.purchasedProduct.definition.id instead?
    Thanks :)
     
    Last edited: Jun 19, 2019
  36. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please take the time to understand what test_product is doing in that code and described in my post, I added that. Please remove that code if you are not returning Pending on your purchases, which is only needed for server-side receipt validation. And please test first, you mention "args.purchasedProduct.definition.id instead" , does it work? It should. Don't be afraid to try things, it's not going to break anything!
     
  37. Divinitize1

    Divinitize1

    Joined:
    May 27, 2019
    Posts:
    101
    Yes "args.purchasedProduct.definition.id" does work perfectly. I will read through and learn what Test_Product does.
    Thanks again.
     
  38. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Actually you should just delete that code, you won't be using it.
     
  39. Divinitize1

    Divinitize1

    Joined:
    May 27, 2019
    Posts:
    101
    Which code sorry? the "Test_Product"? or "args.purchasedProduct.definition.id"?
     
  40. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Previously I mentioned "Please take the time to understand what test_product is doing in that code and described in my post, I added that. Please remove that code if you are not returning Pending on your purchases, which is only needed for server-side receipt validation."
     
  41. Divinitize1

    Divinitize1

    Joined:
    May 27, 2019
    Posts:
    101
    Cool thanks.
    One more question on the matter,
    Let's say a user purchases BlockAds for 99c, but a day later a parent or the user refunds the transaction with Google.
    Is there a system in place on either end to restore ads again?
     
  42. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please show the code that you are using to show ads or not, based on the user purchase.
     
  43. Divinitize1

    Divinitize1

    Joined:
    May 27, 2019
    Posts:
    101
    At the moment just this

    Code (CSharp):
    1.         if(args.purchasedProduct.definition.id == RemoveAds)
    2.         {
    3.           save.adsBlocked = true;
    4.           adsBlockedUI.SetActive(true);
    5.         }
    And that's inside the public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
     
  44. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Perfect! I will follow up with regard to your refund question.
     
  45. Divinitize1

    Divinitize1

    Joined:
    May 27, 2019
    Posts:
    101
    Thanks
     
  46. Divinitize1

    Divinitize1

    Joined:
    May 27, 2019
    Posts:
    101
    There's no rush as it's more of a curiosity thing at this stage, but did you manage to find out any info on the matter yet?
    RE app store refunds and the opposite of restoring purchases.
     
  47. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Not yet, but please test yourself. You'll want to look at the code in OnInitialized. You can go through the products like:

    Code (CSharp):
    1. m_StoreController = controller;
    2.  
    3. foreach (var item in controller) { ... }
    4.  
     
  48. Divinitize1

    Divinitize1

    Joined:
    May 27, 2019
    Posts:
    101
    Sorry, I don't understand how that is linked to my question?
    I can't test refunds on Test Purchases.

    I don't think it will be much of a problem anyway as googles refund policy states

    "Google does not give refunds for most Google Play purchases. However, there are exceptions (see below). You can also contact the developer directly. The developer can help with purchase issues and can process refunds pursuant to its policies and applicable laws."

    The "details below" mainly refer to contacting the developer anyway, so it might just be beneficial to add a no refund policy to the Terms of use or whichever is more common.
     
  49. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  50. tmiller_vb

    tmiller_vb

    Joined:
    Dec 6, 2012
    Posts:
    19
    Hi there. Related to this issue (I think), I'm trying to understand what's going on behind the scenes here. I'm using a test account here.

    Case 1:
    1. Install my app on a device.
    2. Buy a non-consumable in-app purchase within that app.
    3. Delete the app.
    4. Reinstall the app.
    5. Restart the app.
    Results: The purchased IAPs are purchased/downloading as expected.

    Case 2:
    1. After setting up case 1, using the same account, install the same app on a different device.
    2. Start the app.
    Results: The purchased IAPs are considered NOT purchased. I notice that it never calls ProcessPurchase on any of the IAPs I've purchased (unless I specifically buy them again). Since I'm using the same account, it's very odd that it doesn't know I've purchased the IAP.

    Is this working as expected in testing/sandbox? And will the same behavior occur on the live app?