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

Doesn't callback OnPurchaseFailed on Android with IAP version 2.2.0

Discussion in 'Unity IAP' started by zafery, Nov 13, 2020.

  1. zafery

    zafery

    Joined:
    Sep 11, 2014
    Posts:
    9
    Hi,

    I have a game which uses Unity IAP plugin and working without any problem before updating to 2.1.1 version from Package Manager. Also I tried to download from asset store which is currently 2.2.0.
    Problem is, when making a purchase from google play and cancel plugin doesn't call any event like OnPurchaseFailed so I can't return to my main flow.
    Checked both with unity 2020.1.12 and 2019.4.10

    thanks
     
    akasabutski, ex-nihilio and devsompom like this.
  2. Stephane-Imbert

    Stephane-Imbert

    Joined:
    Dec 30, 2014
    Posts:
    14
    I am seeing a similar problem when testing our purchased fail flow. In my case this is simply running the Android platform in the editor (so not really talking to the Google Play store).

    I call controller.InitiatePurchase(product); with a product key that I know was not declared in the builder as a way to force an issue to happen in the editor, but the function initiate purchase simply prints "Trying to purchase null Product" to the console and doesn't call the failed callback. Since the function doesn't return a value either, there is no way to know that the purchase didn't even start and we're stuck on our "please wait" screen.

    Granted this is a test scenario and not one that should happen in a normal situation, but I'd still expect the function to notify us that it returned immediately and there is no upcoming callback.
     
    akasabutski likes this.
  3. devsompom

    devsompom

    Joined:
    Jun 10, 2019
    Posts:
    1
    Hello, I get the same problem. Did you manage to fix it?
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    We are looking into this.
     
  5. BBO_Lagoon

    BBO_Lagoon

    Joined:
    Mar 2, 2017
    Posts:
    190
    Hello, any way to return to version 2.1.1 ?
     
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
  7. BBO_Lagoon

    BBO_Lagoon

    Joined:
    Mar 2, 2017
    Posts:
    190
    thank you very much :)
     
    nicholasr likes this.
  8. BBO_Lagoon

    BBO_Lagoon

    Joined:
    Mar 2, 2017
    Posts:
    190
    Just tested on 2.2.2 and it's fixed, thanks
     
  9. John_Corbett

    John_Corbett

    Unity Technologies

    Joined:
    May 17, 2019
    Posts:
    151
    Hi,

    Was going to post a suggestion to update to the Asset Store plugin v 2.2.2, but you beat me to it. Glad that you tried it and it fixed your problem.

    Also if you are using GooglePlay, we also suggest you update your Package Manager version of In-App Purchasing to 2.2.1
     
  10. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    157
    Just updated both: plugin (2.2.2) and package (2.2.1). However, Unity IAP still doesn't call callback.
    OnPurchaseFailed
    .

    Error message and stacktrace from logcat:
    Code (csharp):
    1. Failed to purchase unknown product {0}: productId:Coffee reason:UserCancelled message:
    2. UnityEngine.Logger:LogError(String, Object)
    3. UnityEngine.Purchasing.PurchasingManager:OnPurchaseFailed(PurchaseFailureDescription)
    4. System.Action:Invoke()
    5. UnityEngine.Purchasing.Extension.UnityUtil:Update()
     
    Wadjey likes this.
  11. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    157
    I use store specific IDs. And there is a bug in In App Purchasing 2.2.1 package.

    I changed 168th line in `PurchasingManager.cs` (method `OnPurchaseFailed`)
    from:
    var product = products.WithStoreSpecificID(description.productId);

    to:
    var product = products.WithID(description.productId);


    And it fixed this issue for me.
     
    Last edited: Nov 25, 2020
    Wadjey likes this.
  12. JustAnotherDude

    JustAnotherDude

    Joined:
    Oct 28, 2013
    Posts:
    279
    Any plans or any chance of integrating those packs under package manager? It would make it so much better to have a single package...
     
  13. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    157
    JustAnotherDude likes this.
  14. John_Corbett

    John_Corbett

    Unity Technologies

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

    We will have them under the same package in the upcoming 3.0.0.
     
    JustAnotherDude likes this.
  15. John_Corbett

    John_Corbett

    Unity Technologies

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

    We'll investigate this and get back to you. Thanks for the information.
     
  16. amjaliks

    amjaliks

    Joined:
    Jul 11, 2015
    Posts:
    157
    Just tried the latest plugin 2.2.3. This appears to be fixed now.
     
    JeffDUnity3D likes this.