Search Unity

Google Play Unavailable product

Discussion in 'Unity IAP' started by Shooter9688, Nov 2, 2018.

  1. Shooter9688

    Shooter9688

    Joined:
    Aug 14, 2017
    Posts:
    7
    I tried to add IAP but faced a problem on initialization.
    Code almost same as here https://unity3d.com/ru/learn/tutorials/topics/ads-analytics/integrating-unity-iap-your-game
    Just deleted all but one managed product.
    First thing that confusing is ProductType Consumable, NonConsumable and Subscription. Now there are only Managed and Subscription in Google play.

    My product is Managed, so I selected NonConsumable (I'm not going to consume it).

    Here is logs:

    11-02 21:17:23.703 7935-23630/? I/UnityIAP: Starting in-app billing setup.
    11-02 21:17:23.709 7935-7935/? I/UnityIAP: Billing service connected.
    11-02 21:17:23.715 7935-23986/? I/UnityIAP: invoking callback
    11-02 21:17:23.715 7935-23986/? I/UnityIAP: Checking for in-app billing 3 support.
    11-02 21:17:23.728 7935-23986/? I/UnityIAP: In-app billing version 3 supported for package_name
    11-02 21:17:23.739 7935-23986/? I/UnityIAP: Subscriptions AVAILABLE.
    11-02 21:17:23.748 7935-23986/? I/UnityIAP: Subscription upgrade and downgrade are AVAILABLE.
    11-02 21:17:23.763 7935-23986/? I/UnityIAP: Subscriptions information parse AVAILABLE.
    11-02 21:17:23.771 7935-23986/? I/UnityIAP: VR supported.
    11-02 21:17:23.772 7935-23986/? I/UnityIAP: onIabSetupFinished: 0
    11-02 21:17:23.772 7935-23986/? I/UnityIAP: Requesting 1 products
    11-02 21:17:23.772 7935-23986/? I/UnityIAP: QueryInventory: 1
    11-02 21:17:23.772 7935-23986/? I/UnityIAP: invoking callback
    11-02 21:17:23.772 7935-23986/? I/UnityIAP: Querying owned items, item type: inapp
    11-02 21:17:23.772 7935-23986/? I/UnityIAP: Package name: package_name
    11-02 21:17:23.772 7935-23986/? I/UnityIAP: Calling getPurchases with continuation token: null
    11-02 21:17:23.784 7935-23986/? I/UnityIAP: Owned items response: 0
    11-02 21:17:23.784 7935-23986/? I/UnityIAP: Continuation token: null
    11-02 21:17:23.784 7935-23986/? I/UnityIAP: Querying SKU details.
    11-02 21:17:24.238 7935-23986/? I/UnityIAP: Querying owned items, item type: subs
    11-02 21:17:24.238 7935-23986/? I/UnityIAP: Package name: package_name
    11-02 21:17:24.238 7935-23986/? I/UnityIAP: Calling getPurchases with continuation token: null
    11-02 21:17:24.253 7935-23986/? I/UnityIAP: Owned items response: 0
    11-02 21:17:24.253 7935-23986/? I/UnityIAP: Continuation token: null
    11-02 21:17:24.253 7935-23986/? I/UnityIAP: Querying SKU details.
    11-02 21:17:24.415 7935-23846/? I/UnityAds: com.unity3d.ads.api.Sdk.logInfo() (line:70) :: AdPlan received with 1 campaigns and refreshDelay 3600
    11-02 21:17:24.481 7935-23986/? I/UnityIAP: Querying owned items' purchase history, item type: subs
    11-02 21:17:24.481 7935-23986/? I/UnityIAP: Package name: package_name
    11-02 21:17:24.481 7935-23986/? I/UnityIAP: Calling getPurchaseHistory with continuation token: null
    11-02 21:17:24.746 7935-23986/? I/UnityIAP: Purchase history response: 0
    11-02 21:17:24.746 7935-23986/? I/UnityIAP: Continuation token: null
    11-02 21:17:24.746 7935-23986/? I/UnityIAP: onQueryInventoryFinished: true
    11-02 21:17:24.746 7935-23986/? I/UnityIAP: Inventory refresh successful. (response: 0:OK)
    11-02 21:17:24.746 7935-23986/? I/UnityIAP: The number of owned skus is0
    11-02 21:17:24.746 7935-23986/? I/UnityIAP: The number of purchased skus is0
    11-02 21:17:24.746 7935-23986/? I/UnityIAP: The number of subscriptions purchased history is0
    11-02 21:17:24.766 7935-23630/? W/Unity: Unavailable product package_name.disable_ads -package_name.disable_ads

    Game downloaded from Google Play store via internal test, product created and active.

    Nothing shows on trying to buy.

    Also I've tried to use android.test.purchase id -- same result.

    What is going wrong?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please show your code where you define your product, and a screenshot of the same product on Google Play. Keep in mind that you can't use your developer account, you must use a tester account to test purchases.
     
  3. Shooter9688

    Shooter9688

    Joined:
    Aug 14, 2017
    Posts:
    7
    Here is part of code,
    Code (CSharp):
    1. internal class PurchaseProvider : IStoreListener, IPurchaseProvider
    2.     {
    3.         private IStoreController storeController; // The Unity Purchasing system.
    4.         private IExtensionProvider storeExtensionProvider; // The store-specific Purchasing subsystems.
    5.  
    6.         private readonly string disableAds = "package_name.disable_ads";
    7.         //private readonly string disableAds = "android.test.purchase";
    8.  
    9.         public PurchaseProvider()
    10.         {
    11.             var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance(AppStore.GooglePlay));
    12.  
    13.             builder.AddProduct(disableAds, ProductType.NonConsumable);
    14.  
    15.             UnityPurchasing.Initialize(this, builder);
    16.         }
    17.  
    18. .....
    19. }
    Constructor calls once on app start, id registered in DI container as singleton.

    upload_2018-11-2_22-44-40.png

    Name is right, I copy-pasted it.
    package_name hides real name, in app it is com.somecompany.someproduct

    Developement account and testing accont is different.

    After trying to buy I got: "BuyProductID FAIL. Not initialized" in logcat

    Admob works right in this app.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You appear to be using two different productIDs, which is what I was checking for. In Google, you have "disable_ads", and in your app you added the package name to the productID. They need to be the same.
     
  5. Shooter9688

    Shooter9688

    Joined:
    Aug 14, 2017
    Posts:
    7
    :) Thanks, you're right! It works now. I thought I was tried it..
    I seen somewhere that I need to specify Id in this way (with com.blah.blah.id), so it was wrong.

    Maybe it is not for this topic, but, unfortunately it not proposes me to use test cards, of corse account is in list of testers, because it internal test. Data in link below seems to be out of date a little.
    https://developer.android.com/google/play/billing/billing_testing#testing-purchases


    upd: After some time it started to work.
     
    Last edited: Nov 3, 2018