Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

IAP error on android phone.

Discussion in 'Unity IAP' started by bumhyo92, Jul 2, 2019.

  1. bumhyo92

    bumhyo92

    Joined:
    Feb 9, 2019
    Posts:
    2
    In my project, UnityIAP looks like work properly on Window computer, when I just use unity run function.
    Here is log.


    UnityIAP Version: 1.22.0
    UnityEngine.Purchasing.StandardPurchasingModule:Instance()
    IAPManager:InitializePurchasing() (at Assets/Scripts/IAPManager.cs:39)
    Using configuration builder objects
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
    OnInitialized: PASS
    UnityEngine.Debug:Log(Object)
    IAPManager:OnInitialized(IStoreController, IExtensionProvider) (at Assets/Scripts/IAPManager.cs:183)
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
    UnityIAP: Promo interface is available for 3 items
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

    [when I hit purchase button]

    Purchasing product asychronously: 'com.illill.perpl.coin250'
    UnityEngine.Debug:Log(Object)
    IAPManager:BuyProductID(String) (at Assets/Scripts/IAPManager.cs:116)
    IAPManager:Buy250Coin() (at Assets/Scripts/IAPManager.cs:68)
    Get_stage:ClickBuy() (at Assets/Scripts/Start_menu/Get_stage.cs:38)
    UnityEngine.EventSystems.EventSystem:Update()
    ProcessPurchase: PASS. Product: 'com.illill.perpl.coin250'
    UnityEngine.Debug:Log(Object)
    IAPManager:processPurchase(PurchaseEventArgs) (at Assets/Scripts/IAPManager.cs:214)
    UnityEngine.Purchasing.PurchasingManager:InitiatePurchase(Product)
    IAPManager:BuyProductID(String) (at Assets/Scripts/IAPManager.cs:119)
    IAPManager:Buy250Coin() (at Assets/Scripts/IAPManager.cs:68)
    Get_stage:ClickBuy() (at Assets/Scripts/Start_menu/Get_stage.cs:38)
    UnityEngine.EventSystems.EventSystem:Update()
    UnityIAP: Promo interface is available for 3 items
    UnityEngine.Purchasing.PurchasingManager:InitiatePurchase(Product)
    IAPManager:BuyProductID(String) (at Assets/Scripts/IAPManager.cs:119)
    IAPManager:Buy250Coin() (at Assets/Scripts/IAPManager.cs:68)
    Get_stage:ClickBuy() (at Assets/Scripts/Start_menu/Get_stage.cs:38)
    UnityEngine.EventSystems.EventSystem:Update()
    purchase({0}): com.illill.perpl.coin250
    UnityEngine.Purchasing.PurchasingManager:InitiatePurchase(Product)
    IAPManager:BuyProductID(String) (at Assets/Scripts/IAPManager.cs:119)
    IAPManager:Buy250Coin() (at Assets/Scripts/IAPManager.cs:68)
    Get_stage:ClickBuy() (at Assets/Scripts/Start_menu/Get_stage.cs:38)
    UnityEngine.EventSystems.EventSystem:Update()


    But when I build and publish android app, purchasing button doesn't work.
    I already published my app on production track. So I want to fix it as soon as possible..
    please help me..

    Here is log when I launch my app and hit purchase button on android phone.


    07-02 13:43:36.633 27550 28251 I UnityIAP: Owned items response: 0
    07-02 13:43:36.633 27550 28251 I UnityIAP: Continuation token: null
    07-02 13:43:36.633 27550 28251 I UnityIAP: Querying SKU details.
    07-02 13:43:36.643 27550 28251 I UnityIAP: Querying owned items' purchase history, item type: subs
    07-02 13:43:36.643 27550 28251 I UnityIAP: Package name: com.illill.perpl
    07-02 13:43:36.643 27550 28251 I UnityIAP: Calling getPurchaseHistory with continuation token: null
    07-02 13:43:36.713 27550 28251 I UnityIAP: Purchase history response: 6
    07-02 13:43:36.713 27550 28251 I UnityIAP: getPurchaseHistory() failed: 6:Error
    07-02 13:43:36.713 27550 28251 I UnityIAP: Querying owned items' purchase history, item type: inapp
    07-02 13:43:36.713 27550 28251 I UnityIAP: Package name: com.illill.perpl
    07-02 13:43:36.713 27550 28251 I UnityIAP: Calling getPurchaseHistory with continuation token: null
    07-02 13:43:36.753 27550 28251 I UnityIAP: Purchase history response: 6
    07-02 13:43:36.753 27550 28251 I UnityIAP: getPurchaseHistory() failed: 6:Error
    07-02 13:43:36.753 27550 28251 I UnityIAP: onQueryInventoryFinished: false
    07-02 13:43:36.753 27550 28251 I UnityIAP: Error query Purchase History (response: 6:Error)
    07-02 13:43:36.753 27550 28251 I UnityIAP: Failed to Query inventory. UnityIAP will automatically retry in 300000ms
    07-02 13:43:36.753 27550 28251 I UnityIAP: QueryInventory: 3
    07-02 13:43:36.753 27550 28251 I UnityIAP: invoking callback

    [when I hit purchase button]
    07-02 13:45:00.543 27550 29710 I Unity : BuyProductID FAIL. Not initialized.
    07-02 13:45:00.543 27550 29710 I Unity : UnityEngine.Logger:Log(LogType, Object)
    07-02 13:45:00.543 27550 29710 I Unity : UnityEngine.Events.UnityEvent:Invoke()
    07-02 13:45:00.543 27550 29710 I Unity : UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
    07-02 13:45:00.543 27550 29710 I Unity : UnityEngine.EventSystems.StandaloneInputModule:processTouchPress(PointerEventData, Boolean, Boolean)
    07-02 13:45:00.543 27550 29710 I Unity : UnityEngine.EventSystems.StandaloneInputModule:processTouchEvents()
    07-02 13:45:00.543 27550 29710 I Unity : UnityEngine.EventSystems.StandaloneInputModule:process()
    07-02 13:45:00.543 27550 29710 I Unity :
    07-02 13:45:00.543 27550 29710 I Unity : (Filename: ./Runtime/Export/Debug.bindings.h Line: 45)
     
  2. bumhyo92

    bumhyo92

    Joined:
    Feb 9, 2019
    Posts:
    2
    I think I found error in my project. But I don't know how to fix it...
    Following is my IAPManger script. And I found "m_StoreController" and "m_StoreExtensionProvider" are null on my android phone !
    How can I fix it? Please help me...

    private static IStoreController m_StoreController; // The Unity Purchasing system.
    private static IExtensionProvider m_StoreExtensionProvider; // The store-specific Purchasing subsystems.

    UnityPurchasing.Initialize(this, builder);

    Debug.Log(m_StoreController == null);
    Debug.Log(m_StoreExtensionProvider == null);
     
  3. SamOYUnity3D

    SamOYUnity3D

    Unity Technologies

    Joined:
    May 12, 2019
    Posts:
    626
    Can you connect to the Google Play service? This error may occur in some areas where Google Play services cannot be used.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Those are uninitialized variables so they would be expected to be null in the code that you show, and is not the issue. However the error 6 is familiar and so far looks to be account specific when calling getPurchaseHistory. Can you test with another account and confirm? We are hearing reports that this only occurs when released to production and not in Alpha/Beta testing which complicates testing. It is also reported that it works with Unity IAP 1.19 but not IAP 1.22, I haven't tested on other versions.
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    The Purchase history response: 6 is caused by changing the user password online but not yet on an unlocked device. This fix is scheduled for the release next week.
     
  6. seppo

    seppo

    Joined:
    Jun 3, 2017
    Posts:
    3
    When is this fix coming? We have live users that are in this state and unable to purchase on Google Play store. Are there any workarounds we can do to fix this issue for these users?
     
  7. emeraldgamestudio

    emeraldgamestudio

    Joined:
    Mar 14, 2017
    Posts:
    7
    I am also getting the exact error using both the IAP tutorial script https://learn.unity.com/tutorial/unity-iap#5c7f8528edbc2a002053b46e and CodelessIAP

    09-14 15:26:08.097: I/UnityIAP(15316): Calling getPurchaseHistory with continuation token: null
    09-14 15:26:08.768: I/UnityIAP(15316): Purchase history response: 6
    09-14 15:26:08.768: I/UnityIAP(15316): getPurchaseHistory() failed: 6:Error

    Like the previous guy said, is there any workaround? When can we expect a fix?
     
  8. emeraldgamestudio

    emeraldgamestudio

    Joined:
    Mar 14, 2017
    Posts:
    7
    I have tried logging off the phone's android account and re-inputting the latest password. I am still getting the exact error.
     
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    What account is logged into Google Play on the device? It needs to the user attempting to make a purchase.The error is from Google and looks to be account and/or password related.