Search Unity

UNITY IAP (Android) - Item already own wrong message

Discussion in 'Unity IAP' started by aastha_appster, Mar 20, 2018.

  1. aastha_appster

    aastha_appster

    Joined:
    Jun 15, 2017
    Posts:
    2
    Hi,

    I am using Unity IAP for purchasing non consumable IAPs on my android device. When I purchase a non consumable IAP on one device it works fine but when I try to purchase the same product on any other device using the same google account it display the message as "Error, you already own this item" but the failure reason received is "UserCancelled".

    On investigating the code and logs I came to know that Google Play IAB is returning the correct error as "Purchase canceled - Response: 7:Item Already Owned" but it is sending the wrong message as "User canceled. (response: -1005:User cancelled)" to unity. This same message is transferred in case if user intentionally cancels the IAP. How to distinguish between two cases?

    I am attaching the screenshot of both the cases

    Unity Cancelled log screenshot
    upload_2018-3-20_16-24-54.png

    Unity Item already owned screenshot
    upload_2018-3-20_16-26-5.png

    Thanks
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @aastha_appster Thank you for reporting this, I will investigate and will check with the IAP team.
     
  3. unityjingyao

    unityjingyao

    Unity Technologies

    Joined:
    Feb 20, 2017
    Posts:
    220
    Hi @aastha_appster
    Which versions of Unity and Unity IAP are you using?
    I did a test with Unity 5.6.1f1 and Unity IAP 1.17.0. I got PurchaseFailureReason.DuplicateTransaction in OnPurchaseFailed() callback.
    Here is my log.
     
  4. aastha_appster

    aastha_appster

    Joined:
    Jun 15, 2017
    Posts:
    2
    I am using Unity version 2017.3.1f1 and latest updated IAP 1.17.0 version. I am also getting the purchase failed event but the reason is user cancelled. I am getting this error every time if I purchase the IAP on different device using the same google account.
     
  5. unityjingyao

    unityjingyao

    Unity Technologies

    Joined:
    Feb 20, 2017
    Posts:
    220
    Hi @aastha_appster ,
    I still couldn't reproduce it.
    Could you please send me a sample project which could reproduce this issue?
    Thank you.
     
  6. diego_mp

    diego_mp

    Joined:
    Jun 12, 2017
    Posts:
    23
    Hi guys,
    I am having exactly the same issue with Unity 2017.4.2f2 and IAP v. 1.16.0
     
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We have improved error handling with IAP 1.19, please test with that version if possible
     
  8. diego_mp

    diego_mp

    Joined:
    Jun 12, 2017
    Posts:
    23
    Hi Jeff,
    I updated the plugin to 1.19 but sadly I have same error as PurchaseFailureReason (UserCancelled) and from
    ITransactionHistoryExtensions.GetLastStoreSpecificPurchaseErrorCode (IABHELPER_USER_CANCELLED).

    This is the log:

    Code (CSharp):
    1. 06-01 17:20:43.810 8756-8834/com.xxxxxxxxxxx I/UnityIAP: Launching buy intent for com.xxxxxxxxxxx.xxxxxxxxxxx. Request code: 999
    2. 06-01 17:21:15.650 8756-8756/com.xxxxxxxxxxx I/UnityIAP: onActivityResult
    3. 06-01 17:21:15.651 8756-8756/com.xxxxxxxxxxx I/UnityIAP: Purchase canceled - Response: 7:Item Already Owned onIabPurchaseFinished: false User canceled. (response: -1005:User cancelled) Purchase response code:-1005
    Google still showing a popup that say "You are already subscribed to XXXXX".

    Any idea?
     
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    As unityjingyao requested, if you could please send us a project that we can use to reproduce. Alternatively you can test with the sample project. Also, regardless of either error (and not to minimize your concern) the user should not be able to purchase again, correct? The "already subscribed" message would be expected since you have already purchased a non-consumable, regardless of device. Can you elaborate how this is affecting your purchase flow? I suspect I am missing something, thanks for your patience. https://forum.unity.com/threads/sample-iap-project.529555/
     
  10. diego_mp

    diego_mp

    Joined:
    Jun 12, 2017
    Posts:
    23
    Hi Jeff,
    you are perfectly right, it shouldn't affect our flow. Sadly we live in a flawed world where we don't design the features :)
    In our case, under iOS, AppleStore doesn't have such behaviour and when you have a duplicated transaction, we get a successful purchase and the Store just pop a message telling the user that he/she already paid.
    GooglePlay has a different behaviour that tell us we fail the payment for duplicated transaction.
    Sadly, our flow was based on iOS so if we could just capture the right error, we could change the failure in success and keep a consistent flow within the App.

    I'll try to make a repro-project, thanks for the reply.
     
  11. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    On iOS, you should not get a successful purchase (it has already been purchased), and the message that you mentioned telling the user that they have already paid implies the same (a duplicate transaction). I wasn't quite clear on your response, are you saying on iOS, it allows the user to purchase a non-consumable on different devices with the same account? That would be behavior that would need to be addressed if so.
     
  12. diego_mp

    diego_mp

    Joined:
    Jun 12, 2017
    Posts:
    23
    I'm saying that on iOS (sandbox environment) i can do multiple purchase of a "subscription" (careful here, in Unity's catalogue seems to be a separated option from consumable and not-consumable) with same AppleID, same device.
    It is definitively a duplicated purchase from a logic POV but Unity's IAP pass it as good.
    On Android, i get the failure but the reason is wrong because I get "UserCancelled" which is not true.

    [UPDATE]
    I created a new solution, latest IAP plugin, using "IAP Demo" scene; still get same behaviour on Android (duplicated transaction returns IABHELPER_USER_CANCELLED).

    Cheers
     
    Last edited: Jun 5, 2018
  13. ap-unity

    ap-unity

    Unity Technologies

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

    We were able to find out what the problem was. The fix didn't make it in time for 1.20, but it should be fixed in the version after that.

    Thanks for reporting this issue.
     
  14. diego_mp

    diego_mp

    Joined:
    Jun 12, 2017
    Posts:
    23
  15. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    481
    @ap-unity Did the fix get in a new versions? I'm seeing this issue as well.
     
  16. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Not yet, it will be in the next release within a few weeks.
     
  17. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    481
    Hey @JeffDUnity3D: what will the fix be? As in: what will the error message / code be once this is fixed?
     
  18. _Adriaan

    _Adriaan

    Joined:
    Nov 12, 2009
    Posts:
    481
    (And can you say anything about a potential release date? My iAP release is coming up and I do not look forward to the hundreds of support messages from people with multiple devices ;)
     
  19. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    A few weeks is the best we can say right now. My hope is 2 weeks, but that may change. It's a large integrated release, and it's currently going through QA. The timing depends on any potential issues that might be found during the QA process.
     
  20. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    The latest version of IAP is now available 1.20.1
     
    kyunghun-cho and _Adriaan like this.
  21. Tommi-Kiviniemi

    Tommi-Kiviniemi

    Joined:
    Aug 21, 2014
    Posts:
    8
    This doesn't seem to be fixed in 1.20.1.

    Repro steps:
    Trigger a purchase on Google Play
    Tap "1 tap buy"
    Disconnect net quickly (easiest is to disable Wifi through control center)
    Go back to game (swipe out control center)
    Google Play will say you don't have internet for the purchase
    Our game invokes a purchase failed dialog
    Turn net on again
    Trigger the same purchase on Google Play
    Tap "1 tap buy"
    Google Play says "Error: You already own this item"
    This happens at least for consumables, we haven't tested for other purchase types.
     
    ncortesp likes this.
  22. Tommi-Kiviniemi

    Tommi-Kiviniemi

    Joined:
    Aug 21, 2014
    Posts:
    8
    Should we interpret that as a fix was supposed to be in 1.20.1, or was it just a generic heads up that a new version is available? Thanks.
     
  23. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  24. ncortesp

    ncortesp

    Joined:
    Oct 28, 2016
    Posts:
    42
    I'm experiencing the same issue.
     
  25. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    We are investigating.
     
  26. Num0n1

    Num0n1

    Joined:
    Aug 19, 2016
    Posts:
    8
    we are seeing the same thing,
    seems the purchase request sent to google was sucessful,
    but with some connection disturb, client(iap) does not know that,
    if i tried to re-install the app and refresh google play store, re-launch the app will trigger ProcessPurchase,
    however, when return "PurchaseProcessingResult.Complete", there is an exception: "Unity: java.io.EOFException"
     
  27. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @Num0n1 We have been able to reproduce here, and now working to address the issue. The hope is the update will be in the next release which may be later this year or early into 2019.
     
  28. PatrickMZ

    PatrickMZ

    Joined:
    Oct 17, 2016
    Posts:
    11
    Hello,
    we are experiencing the same thing with consumeables in version 1.20.1.
    when there is a connection issue while connecting to google play server we cannot purchase the same item again.
    the error: "Already Owned" appears but this product item does not has a receipt or transactionId.

    please keep us updated about the progress of a fix. thanks...
     
  29. Num0n1

    Num0n1

    Joined:
    Aug 19, 2016
    Posts:
    8
    Thanks for your attention on this issue, recently we have encountered something similar.
    We are using v1.20.1.
    We have users' log showing PurchaseFail reason "DuplicateTransaction", from what we have learned, it seems ProcessPurchase is not called after a successful purchase, and if the user trys to buy the same product, it will go straight to onPurchaseFail with reason "DuplicateTransaction", it will not show the google payment popup at all.
    By fixing this, the user needs to refresh google play store, maybe even switch wifi or 4G, re-launch our app, than ProcessPurchase will be called.
    Not sure if this is the same problem, but seems IAP does know the purchase is completed for this scenario.
    We thought it's just because of bad internet connection, but we are getting this once every 2 or 3 days which is a bit strange.
     
    KonstantinShkulev and lwangwangl like this.
  30. YusukeTanaka

    YusukeTanaka

    Joined:
    Nov 9, 2016
    Posts:
    3
    Hello,
    This bug is still occurring in many games released in Japan.
    I expect that this bug will be solved with the new version and I am longing for the release.

    I am very happy if you can raise the priority.
     
  31. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Unfortunately we have no control over the release schedule, we have to coordinate with several other product teams
     
  32. quanbp

    quanbp

    Joined:
    Jan 5, 2018
    Posts:
    3
    Updated to latest IAP version but issue still persist. Please release the fixed version!!!
     
  33. unity_K6RE9Byo6N7pFg

    unity_K6RE9Byo6N7pFg

    Joined:
    Feb 4, 2019
    Posts:
    13
    Hi All,
    this is diego_mp a year later, U2018.4.0f1, IAP 2.0.6 and the bug is still there. Getting userCancelled from a duplicated transaction under iOS.
    @JeffDUnity3D @ap-unity please advice.

    Cheers!
     
  34. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    To ensure it is the same issue and/or a regression, can you provide steps to reproduce?
     
  35. unity_K6RE9Byo6N7pFg

    unity_K6RE9Byo6N7pFg

    Joined:
    Feb 4, 2019
    Posts:
    13
    I am sorry for the late reply.

    - To reproduce the issue please buy a renewable subscription with a trial period in iOS, sanbox environment (not sure this is useful but let try my same settings).
    - Kill the app once you receive successfully the receipt.
    - restart the app and proceed to buy the same IAP item.
    - Observe userCancelled as the reason for the failed purchase.

    Cheers!
     
  36. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    How are you killing the app?
     
  37. cumi233

    cumi233

    Joined:
    Oct 25, 2019
    Posts:
    3
    I got the same problem in IAP 1.22.0
    1.buy a subscribe,and it first end with success
    2.buy the same subscribe again, and it return error "DumplicateTransaction"
    and I found these:
    12-05 12:54:42.464 22583-22866/? I/UnityIAP: onIabPurchaseFinished: false
    12-05 12:54:42.464 22583-22866/? I/UnityIAP: Unable to buy item (response: 7:Item Already Owned)
    12-05 12:54:42.464 22583-22866/? I/UnityIAP: Purchase response code:7
     
  38. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    626
    This is an expected behavior and for subscription products, you cannot purchase it again until the product expires.
    If you want to buy the same product multiple times, then you should define it as a consumable product type.
     
  39. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    What I typically do to test non-consumables is to either 1) configure several similar subscription products 2) configure multiple tester accounts
     
  40. SteveKouts

    SteveKouts

    Joined:
    Aug 23, 2012
    Posts:
    79
    Is this fixed? Ive switched to Unity IAP from Unibill(Deprecated) And I thought it was working, but I could only do one successful purchase of a consumable now the button doesn't do anything. LogCat shows already purchased error, duplicate transaction. Really?? How? This is a consumable which is meant for repeat purchase. How to fix this please? need fix asap.
     
  41. SteveKouts

    SteveKouts

    Joined:
    Aug 23, 2012
    Posts:
    79
    I solved this by adding this code to the CodelessIAPStoreListener

    foreach (var product in m_StoreController.products.all)
    {
    m_StoreController.ConfirmPendingPurchase(product);
    }

    Source for the fix:
    http://codesaying.com/unity-iap-stuck/
     
  42. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    This should not be needed if you have Consume checked for your IAP Button. You would want to understand why the products are left in Pending in the first place. All products would be in your controller, including those that the user has not purchased yet. You are trying to consume products that haven't been purchased yet. We plan to add additional error handling to ConfirmPendingPurchase, and it would fail in your scenario. You should not be coding Codeless, as the name implies. It is not supported. If you need to code anything, this is a clear signal to use scripted IAP instead. It will save you much time.
     
    Last edited: Apr 13, 2020
  43. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Getting back to the original post. This is a known Google issue, restore does not occur across devices unless you clear the Google Play cache first. We are working with Google to resolve the issue and hopefully get their updated billing library into the next release soon.
     
  44. YusukeTanaka

    YusukeTanaka

    Joined:
    Nov 9, 2016
    Posts:
    3
    Thank you for considering update billing library. Has the latest Unity IAP resolved this issue?
     
  45. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Apparently it has helped, but has not completely resolved the issue. Are you still seeing the behavior?
     
  46. YusukeTanaka

    YusukeTanaka

    Joined:
    Nov 9, 2016
    Posts:
    3
    I will update Unity IAP version and check it. I'll report back if the same error occurs. Thank you.
     
  47. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    A full fix is expected in an upcoming release, to properly set expectations
     
  48. NMJ_GD

    NMJ_GD

    Joined:
    Dec 28, 2019
    Posts:
    14
    Hey I have same problem "Error, you already own this item". I have 2019.2.8f unity, android, added External dependecy and FB sdk (newest both). It is showing this problem can this plugins be problem? I have tried several ways (delete cache and data of play store, changed
    Code (CSharp):
    1. public void OnInitialized(IStoreController ext_controller, IExtensionProvider exT_extensions)
    2.         {
    3.             initializationComplete = true;
    4.             this.controller = ext_controller;
    5.             this.extensions = exT_extensions;
    6.             foreach (var product in controller.products.all)
    7.             {
    8.                 controller.ConfirmPendingPurchase(product);
    9.             }
    10.             foreach (var button in activeButtons)
    11.             {
    12.                 button.UpdateText();
    13.             }
    14.         }
    like this. Added restore button (even though I read in documentation google does it automatically and I don't need to add restore button). I don't know what to do? Do you know any solution I use latest 2.2.1 iap. (had 2.0.6 verified version but same problem)
     
  49. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @NMJ_GD Please test with IAP 2.2.2 which is now available. If you continue to have issues, please provide specific steps to reproduce.
     
  50. NMJ_GD

    NMJ_GD

    Joined:
    Dec 28, 2019
    Posts:
    14