Search Unity

Bug Scripted IAP initialization issue

Discussion in 'Unity IAP' started by Fragbit, Oct 31, 2022.

  1. Fragbit

    Fragbit

    Joined:
    Feb 8, 2022
    Posts:
    2
    • Description of your issue
      • Before upgrading from 3.2.2 to 4.5.1 (mainly because of the Google Play Billing V4 requirement) everything was working fine for all of my users. But after the upgrade a portion of my users cannot use the IAPs anymore. It looks like the scripted IAP manager is not initializing - neither OnInitialized nor OnInitializeFailed are called but it looks like the
        SetQueryProductDetailsFailedListener callback is being called. Which implies connections/internet issues but we're sure that it's not the case since those users verified that the internet is working just fine, all other apps have no issues connecting to the internet, our ads are loading just fine along with all the other online features - this connection issue exists only with IAPs. Codeless IAPs are disabled, I'm not using the Codeless catalog and both enableCodelessAutoInitialization and
        enableUnityGamingServicesAutoInitialization are set to false (I'm initializing UGS manually in the loading scene prior to initializing IAP script.
    • Your purchasing script
      • Attached to the post, it's 99% the same as in the demo project.
    • Device logs
      • We're still trying to get a hold of a device that experience those issues to get the device logs
    • Unity Version
      • 2020.3.39f1
    • Unity IAP version
      • 4.5.1
    • Platform you are building for
      • Android
    • Store you are targeting
      • Google Play Store
     

    Attached Files:

  2. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    Hi @Fragbit,

    We have had requests from users to get this callback in the case that the users of their apps are signed out of their Google Play accounts. This means that connection to the GooglePlay Store will remain in limbo until the user goes into the Google Play app and completes their sign in to their account.

    We can't control this directly from the Google Play Billing Library. Google Accounts are another library and doesn't fall into IAP's rubric.

    Can you check if this is the case?

    Also, please note this detail from IAP 4.3.0:

    - GooglePlay - API `IGooglePlayConfiguration.SetQueryProductDetailsFailedListener(Action<int>)` called when Unity IAP fails to query product details. The `Action` will be called on each query product details failure with the retry count. See documentation "Store Guides" > "Google Play" for a sample usage.

    We suggest that you don't treat it as an final failure. Please see this page in the manual: https://docs.unity3d.com/Packages/com.unity.purchasing@4.5/manual/UnityIAPGooglePlay.html

    You can use
    IGooglePlayConfiguration.SetServiceDisconnectAtInitializeListener
    as a means to detect this situation for connection issues due to the user not having completed their sign in.

    Hope this helps.

    If not, please tell us what else you might know about the user's experience, and we can look in further
     
  3. Fragbit

    Fragbit

    Joined:
    Feb 8, 2022
    Posts:
    2
    Hi @John_Corbett,

    Sorry for the late reply but I wanted to get more informations before answering.

    So, I did add the callback for SetServiceDisconnectAtInitializeListener and it turns out that it is being called suggesting that the issue lies with some kind of sign-in issue on the user end. But we have screenshot confirmations that the user is signed-in just fine both in Google Play Store app and in the device itself too - I can even share them with you if needed.

    Keep in mind also, that none of that person other games have any issues with IAP purchases and none of our users experienced them prior to upgrading IAP purchasing package to 4.5.1 (no reports from ~700k users, I'd assume that's a fair sample size). Those issues only started happening recently after upgrading IAP package and switching to Google Play Billing v4 - seems like that's the biggest change here.

    I'll add device logs here that we've managed to grab - they're quite verbose as filtering them only by 'unity' resulted in nothing exceptional but i tried to trim them to before beggining IAP initialization and just after we get the SetServiceDisconnectAtInitializeListener callback. Maybe you'll find something interesting there.

    Saying that, we did manage to fix this, so to speak... Turns out that this particular user was signed out of Google Play Games app and it asked him to sign-in again. And for whatever reason doing that fixed this issue on that specific device. I have no confirmation yet from anyone but that person that this is a fix for that issue but it is something to note for sure, I'll keep you posted. How is Google Play Games related to Unity IAP package or Google Play Billing Library? I have no idea.
     

    Attached Files:

    • log.txt
      File size:
      369.3 KB
      Views:
      160
  4. John_Corbett

    John_Corbett

    Joined:
    May 17, 2019
    Posts:
    151
    Hi @Fragbit ,

    Just to confirm, there is a second step in the Sign-in in Google Play. This occurs, among other ways, when the user does a remote sign-out from a browser window on another device. I'm not saying this is the only reason, but it is a subtle one. It could be that the sign in step was that of the Google Play Games app, as well.

    Sadly unless one includes the API for the Google Account into an app, there is no way to detect it. Adding that to the IAP SDK would add potentially risky to permissions to any app using it, and we don't want to force this onto apps that don't want that.

    Yes, please share the screenshot and feel free to redact any user info.

    As for Google Play Games itself, usually it's for game achievements and leaderboards and stuff like that. IAP doesn't use it at all, however, Google Play Games probably has some kind of sign-in link to the Google Play account in general. Sadly I'm ignorant of this link, as we don't use any Google Account API.

    All we know is that in order to fully connect the Google Play Billing's store client API, the user playing the game must be fully connected and signed in to Google Play, otherwise there's no way Google play Billing can confirm it's them. The interaction of their account stuff is internal to the Google Play Billing module and invisible to us on the IAP SDK.

    Do you by chance, use the GooglePlay account API in your app? Do you use GooglePlay Games' API?

    How prevalent is this issue among your 700k player base?

    Sorry I only have more questions for you at this time, but I suggest adding the suggestion to check their login status in the Google Play and Google Play Games apps when you get SetServiceDisconnectAtInitializeListener . Usually this is a one-time deal and it won't happen then next time they login... pleasee correct me if that's not the case.