Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unity IAP Service - Item already purchased error

Discussion in 'Android' started by JesseLaChapelle, Jul 15, 2016.

  1. JesseLaChapelle

    JesseLaChapelle

    Joined:
    Jun 10, 2016
    Posts:
    7
    Hello,

    I am having an issue attempting to port our Unity IAP to Android. We have an implementation and menu flow that we have testing successfully on iOS. The same call sequence appears to fail on Android. The purchase always seems to fail with an "Item already owned".

    After we discovered this issue, we reset our test device, and created a new Google test account. So I'm quite sure there are no purchases on the device or in the cloud.

    We are using Unity 5.3.4
    Testing on a Samsung Galaxy Tab A, Android 5.0.2

    Log follows:

    =================================

    07-15 09:57:13.275: I/Unity(5119): Purchasing product asychronously: 'com.product.episode2'
    07-15 09:57:13.275: I/Unity(5119):
    07-15 09:57:13.275: I/Unity(5119): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    07-15 09:57:13.275: I/UnityIAP(5119): onPurchaseProduct: com.product.episode2
    07-15 09:57:13.275: I/UnityIAP(5119): ITEM TYPE:inapp
    07-15 09:57:13.305: I/Unity(5119): purchase({0}): com.product.episode2
    07-15 09:57:13.305: I/Unity(5119):
    07-15 09:57:13.305: I/Unity(5119): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    07-15 09:57:13.405: I/Unity Purchasing(5119): Creating purchase activity
    07-15 09:57:13.405: I/UnityIAP(5119): invoking callback
    07-15 09:57:13.405: I/UnityIAP(5119): Constructing buy intent for com.product.episode2, item type: inapp
    07-15 09:57:13.425: I/UnityIAP(5119): Launching buy intent for com.product.episode2. Request code: 999
    07-15 09:58:37.665: I/UnityIAP(5119): onActivityResult
    07-15 09:58:37.665: I/UnityIAP(5119): Purchase canceled - Response: 7:Item Already Owned
    07-15 09:58:37.665: I/UnityIAP(5119): onIabPurchaseFinished: false
    07-15 09:58:37.665: I/UnityIAP(5119): User canceled. (response: -1005:User cancelled)
    07-15 09:58:37.665: I/UnityIAP(5119): Purchase response code:-1005
    07-15 09:58:37.805: I/Unity(5119): onPurchaseFailedEvent({0}): com.product.episode2
    07-15 09:58:37.805: I/Unity(5119):
    07-15 09:58:37.805: I/Unity(5119): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    07-15 09:58:37.815: I/Unity(5119): Purchase Failed
    07-15 09:58:37.815: I/Unity(5119):
    07-15 09:58:37.815: I/Unity(5119): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    07-15 09:58:37.815: I/Unity(5119): OnPurchaseFailed: FAIL. Product: 'com.product.episode2', PurchaseFailureReason: UserCancelled
    07-15 09:58:37.815: I/Unity(5119):
    07-15 09:58:37.815: I/Unity(5119): (Filename: ./artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

    ===================

    Has anyone seen similar issues? Any insight or direction would be appreciated.
     
  2. JesseLaChapelle

    JesseLaChapelle

    Joined:
    Jun 10, 2016
    Posts:
    7
  3. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    What version of our store package are you running? You can find this in your project's Unity IAP folder at the top of Changelog.md.

    If you are running a version less than 1.6.0 this erroneous behaviour will happen in Google's sandbox environment.

    Please make sure you're running the latest version of our store package (1.6.1 at time of writing)
     
  4. JesseLaChapelle

    JesseLaChapelle

    Joined:
    Jun 10, 2016
    Posts:
    7
    We tried the update to 1.6 and the issue remained. In our case however it only seems to happen with the use of redeem codes to purchase. Adding valid a valid credit card to test purchases doesn't exhibit this issue.
     
  5. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    Upon investigation I have found one promo code issue which is that promo codes redeemed whilst the App is running will not be detected until App restart. This will be fixed in our next store release.

    Does ProcessPurchase get called when you restart the App?
     
  6. JesseLaChapelle

    JesseLaChapelle

    Joined:
    Jun 10, 2016
    Posts:
    7
    I believe so, as the item does appear as purchased after restarting the app.
     
  7. Banderous

    Banderous

    Joined:
    Dec 25, 2011
    Posts:
    669
    In which case our next release should fix this for you, likely in the next couple of days.
     
    erika_d likes this.
  8. iLyxa3D

    iLyxa3D

    Joined:
    Sep 25, 2013
    Posts:
    31
    After reactivating Unity Service In-App Purchasing component in UnityEditor, 999 error disappear and all works fine..
     
  9. Azerty01

    Azerty01

    Joined:
    May 23, 2017
    Posts:
    1