Search Unity

Android: 'PurchasingUnavailable' and 'ProductUnavailable'

Discussion in 'Unity IAP' started by MoinTom, Feb 27, 2017.

  1. MoinTom

    MoinTom

    Joined:
    May 8, 2015
    Posts:
    15
    Hello guys,
    we encounter some 'PurchasingUnavailable' and 'ProductUnavailable' errors on the Android platform. It seems to increase lately so we looked into it. But we couldn't really find anything.

    Here just quick the documentation definitions to get it out of the way:

    PurchaseFailureReason.PurchasingUnavailable
    The system purchasing feature is unavailable.
    Unity IAP may be disabled in security settings, or the system purchasing library may be outdated.

    PurchaseFailureReason.ProductUnavailable
    The product is not available to purchase on the store.
    Check the product definition in the store.

    About 0,5% of our Android customers encounter this problem (at least one of those problems but no pattern to spot here).
    It also seems not to be consequent, since some users who already payed before faced the problem afterwards.

    Since both documentation definition are just "abstract" (a lot of "may" ;)) and the "ProductUnavailable" should be consequent be thrown or not, we wonder if there is a way to dig further into it. It would be more then nice to be able to tell our customers what to do when facing such a problem.

    One stack trace we found during our research was the following:

    Unable to cache IAP catalog: System.UnauthorizedAccessException: Access to the path '/storage/emulated/0/Android/data/<bundle-id>/files/Unity/82d11ea9-91c6-4fe8-b5e3-8c8276dbb058/IAP' is denied. at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0 at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0 at UnityEngine.Purchasing.UnityPurchasing.InstantiateCatalog (System.String storeName) [0x00000] in <filename unknown>:0

    We believe that this could be related to this problem.


    Best Regards
    Tom
     
  2. ap-unity

    ap-unity

    Unity Technologies

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

    Would you be able provide some more details about the type of devices that are getting this error? (device country, carrier, make, model, OS version, etc.)

    Another possibility is that it is an increase in user's denying write permission. This would result in a similar error.
     
  3. LandSharkGames4

    LandSharkGames4

    Joined:
    Aug 2, 2016
    Posts:
    4
    Our team is also facing this issue on some of our user's Android platform. Right now we do not have any helpful information as it is working normally on our test devices.
     
  4. MoinTom

    MoinTom

    Joined:
    May 8, 2015
    Posts:
    15
    @ap-unity
    Thanks for your reply.

    Unfortunately we don't have informations about the os version, but what we have the device model and the user countries available.
    Here the most recent cases (about the last 90 Minutes from our logs):

    unique device models:
    • samsung SM-T530
    • LGE LG-D802
    • motorola MotoE2(4G-LTE)
    • samsung GT-I9300
    • LGE LG-D802
    • motorola XT1034
    • Sony C1905
    • samsung GT-I9300T
    • WIKO LENNY2
    • samsung SM-G610F
    • samsung SGH-I337M
    • ZTE ZTE Blade L3
    • samsung GT-I8190L
    • samsung SM-G900H
    • samsung SM-A310F
    unique countries:
    • US
    • BN
    • FR
    • DE
    • IR
    • BR
    • ZA
    • CA
    • IT
    • NZ

    @LandSharkGames4
    Yes we have the same issue. Everything works just fine on our test devices and we have a good amount of different models and device types... including different OSVersions.
     
    Last edited: Mar 16, 2017
    nicholasr likes this.
  5. LandSharkGames4

    LandSharkGames4

    Joined:
    Aug 2, 2016
    Posts:
    4
    @MoinTom
    May I ask what version of IAP plugins are you using?
     
  6. MoinTom

    MoinTom

    Joined:
    May 8, 2015
    Posts:
    15
    @LandSharkGames4
    We are using [1.10.0] - 2017-01-23 in our most recent live build.
     
  7. ap-unity

    ap-unity

    Unity Technologies

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

    Thanks for that extra information.

    Have you tested your app where you denied permission to file system and see if that gives a similar error? I believe there was a change to Android that makes it easier for user's to deny individual app permissions.

    However, Unity IAP should not fall over like this. We are going to make some improvements to how we handle this System.UnauthorizedAccessException. This should give you an error during initialization, so you can handle this situation more gracefully. This change will likely require an engine update, so it will may take a bit of time before it's available.

    In the meantime, you could catch this exception yourself and handle it the same way as an OnInitializedFailed call. Sorry for this inconvenience.
     
    nicholasr likes this.
  8. MoinTom

    MoinTom

    Joined:
    May 8, 2015
    Posts:
    15
    @ap-unity
    Thanks for the feedback.

    I just tried to use our app with revoked storage permission and it worked just fine. It could still be possible to be a combination out of OS version an file system accessibility.

    We implemented further instrumentalisation into our app and it will ship next week. So we will be able to tell if the file system is accessible, which the Application.persistentDataPath is and which OS version is used. That should help to nail the problem down.

    ps: Let us know if you have other things in mind we could test out :)
     
    ap-unity and nicholasr like this.
  9. MoinTom

    MoinTom

    Joined:
    May 8, 2015
    Posts:
    15
    @ap-unity
    We have some more informations from our recent deployment. (Version is still - [1.10.0] - 2017-01-23)

    We checked for lang, PersistentDataPath, ReadWriteAccess (if PersistentDataPath is read/writeable), DeviceModel and OSVersion. This are our results from the most recent cases:

    'lang' => 'en',
    'UnityPurchasingFailed' => 'PurchasingUnavailable',
    'PersistentDataPath' => '/storage/emulated/0/Android/data/<bundle-id>/files',
    'ReadWriteAccess' => 'true',
    'DeviceModel' => 'samsung SM-N910F',
    'OSVersion' => 'Android OS 6.0.1 / API-23 (MMB29M/N910FXXS1DQC3)',

    'lang' => 'de',
    'UnityPurchasingFailed' => 'PurchasingUnavailable',
    'PersistentDataPath' => '/storage/emulated/0/Android/data/<bundle-id>/files',
    'ReadWriteAccess' => 'true',
    'DeviceModel' => 'Allwinner M1009',
    'OSVersion' => 'Android OS 4.4.4 / API-19 (KTU84Q/20150417)',

    'lang' => 'en',
    'UnityPurchasingFailed' => 'PurchasingUnavailable',
    'PersistentDataPath' => '/storage/emulated/0/Android/data/<bundle-id>/files',
    'ReadWriteAccess' => 'true',
    'DeviceModel' => 'motorola MotoG3',
    'OSVersion' => 'Android OS 6.0.1 / API-23 (MCI24.107-79/64)',

    'lang' => 'de',
    'UnityPurchasingFailed' => 'PurchasingUnavailable',
    'PersistentDataPath' => '/storage/emulated/0/Android/data/<bundle-id>/files',
    'ReadWriteAccess' => 'true',
    'DeviceModel' => 'WIKO LENNY3',
    'OSVersion' => 'Android OS 6.0 / API-23 (MRA58K/1453981211)',

    'lang' => 'en',
    'UnityPurchasingFailed' => 'PurchasingUnavailable',
    'PersistentDataPath' => '/storage/emulated/0/Android/data/<bundle-id>/files',
    'ReadWriteAccess' => 'true',
    'DeviceModel' => 'samsung GT-I9300',
    'OSVersion' => 'Android OS 4.3 / API-18 (JSS15J/I9300XXUGNJ2)',

    'lang' => 'en',
    'UnityPurchasingFailed' => 'PurchasingUnavailable',
    'PersistentDataPath' => '/storage/emulated/0/Android/data/<bundle-id>/files',
    'ReadWriteAccess' => 'true',
    'DeviceModel' => 'asus ASUS_T00N',
    'OSVersion' => 'Android OS 4.4.2 / API-19 (KOT49H/TW_PadFone-11.10.5.52-20140729)',

    'lang' => 'tr',
    'UnityPurchasingFailed' => 'PurchasingUnavailable',
    'PersistentDataPath' => '/storage/sdcard0/Android/data/<bundle-id>/files',
    'ReadWriteAccess' => 'true',
    'DeviceModel' => 'Sony C1905',
    'OSVersion' => 'Android OS 4.1.2 / API-16 (15.1.C.2.8/7bd96g)',

    'lang' => 'pt',
    'UnityPurchasingFailed' => 'PurchasingUnavailable',
    'PersistentDataPath' => '/storage/sdcard0/Android/data/<bundle-id>/files',
    'ReadWriteAccess' => 'true',
    'DeviceModel' => 'samsung GT-S6313T',
    'OSVersion' => 'Android OS 4.1.2 / API-16 (JZO54K/S6313TVJANB1)',

    'lang' => 'en',
    'UnityPurchasingFailed' => 'PurchasingUnavailable',
    'PersistentDataPath' => '/storage/emulated/0/Android/data/<bundle-id>/files',
    'ReadWriteAccess' => 'true',
    'DeviceModel' => 'HUAWEI Y538',
    'OSVersion' => 'Android OS 5.1.1 / API-22 (HuaweiY538/C237B150)',

    'lang' => 'en',
    'UnityPurchasingFailed' => 'PurchasingUnavailable',
    'PersistentDataPath' => '/storage/emulated/0/Android/data/<bundle-id>/files',
    'ReadWriteAccess' => 'true',
    'DeviceModel' => 'samsung GT-P3110',
    'OSVersion' => 'Android OS 4.2.2 / API-17 (JDQ39/P3110XXDMH1)',

    'lang' => 'en',
    'UnityPurchasingFailed' => 'PurchasingUnavailable',
    'PersistentDataPath' => '/storage/emulated/0/Android/data/<bundle-id>/files',
    'ReadWriteAccess' => 'true',
    'DeviceModel' => 'samsung GT-P3110',
    'OSVersion' => 'Android OS 4.2.2 / API-17 (JDQ39/P3110XXDNE1)',

    I don't see any particular pattern, but maybe you see anything. Good luck!

    Best
    MoinTom
     
    ap-unity likes this.
  10. ap-unity

    ap-unity

    Unity Technologies

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

    Thanks for providing that information. Unfortunately, we don't really notice a pattern either. Would you be able to PM a link to your app? We have one of the listed devices, so we're gonna try and see if we can reproduce this issue.
     
  11. MoinTom

    MoinTom

    Joined:
    May 8, 2015
    Posts:
    15
  12. LandSharkGames4

    LandSharkGames4

    Joined:
    Aug 2, 2016
    Posts:
    4
    @ap-unity @MoinTom
    I have been doing some logging on our side, here are some device details and stack trace
    Error: PurchasingUnavailable

    Device
    OPPO 1201|Android OS 5.1 / API-22 (LMY47I/1451409199)
    HUAWEI ALE-L21|Android OS 6.0 / API-23 (HuaweiALE-L21/C432B594)
    HUAWEI EVA-AL10|Android OS 6.0 / API-23 (HUAWEIEVA-AL10/C00B168)
    HUAWEI HUAWEI Y625-U21|Android OS 4.4.2 / API-19 (HUAWEIY625-U21/C577B107)
    asus P023|Android OS 5.0.2 / API-21 (LRX22G/WW_P023-V4.7.5-20160419)
    TCL C15150m|Android OS 5.0 / API-21 (LRX21M/23)
    samsung SM-G9300|Android OS 7.0 / API-24 (NRD90M/G9300ZCU2BQC1)
    samsung SAMSUNG-SM-N920A|Android OS 6.0.1 / API-23 (MMB29K/N920AUCS4CQA1)
    motorola MotoE2(4G-LTE)|Android OS 5.0.2 / API-21 (LXI22.50-53.8/14)

    Stack Trace
    at System.Environment.get_StackTrace()
    at IAP.OnInitializeFailed(InitializationFailureReason error)
    at UnityEngine.Purchasing.StoreListenerProxy.OnInitializeFailed(InitializationFailureReason error)
    at UnityEngine.Purchasing.PurchasingManager.OnSetupFailed(InitializationFailureReason reason)
    at UnityEngine.Purchasing.NativeJSONStore.OnSetupFailed(System.String reason)
    at UnityEngine.Purchasing.ScriptingUnityCallback+<OnSetupFailed>c__AnonStorey0.<>m__0()
    at UnityEngine.Purchasing.Extension.UnityUtil.Update()
     
    ap-unity and MoinTom like this.
  13. happirt

    happirt

    Joined:
    Dec 30, 2018
    Posts:
    14
    Bump.

    Has there been any progress with this issue? One of my users is experiencing it using a Chromebook.
     
  14. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @happirt Chromebook is not a supported platform.