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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Resolved My game can not find any IAP productID even I already add them in Google Play Console

Discussion in 'Unity IAP' started by tuantruongminh, Dec 24, 2022.

  1. tuantruongminh

    tuantruongminh

    Joined:
    Feb 13, 2019
    Posts:
    15
    Hi Unity Techinicals

    My game can not find my product IDs even I already created them on Google Play Console.

    I post some pictures bellow, please help to check why the IAP not working
    upload_2022-12-24_9-33-53.png
    upload_2022-12-24_9-34-15.png

    I have already activated play game platform
    upload_2022-12-24_9-35-38.png

    I use Unity IAP package
    upload_2022-12-24_9-36-15.png
    and enable it
    upload_2022-12-24_9-37-1.png

    When I click buy button, it has an no reference error.
     
  2. tuantruongminh

    tuantruongminh

    Joined:
    Feb 13, 2019
    Posts:
    15
    I would like to add one thing. I changed the all product ID to lower case already. For example org.Game4Everyone.RatTunnelRevolution to org.game4everyone.rattunnelrevolution
    why the game is still searching for the uppercase product ID when the fact is that I ve already changed it to lowercase?
     
  3. rommel89

    rommel89

    Joined:
    Jul 4, 2019
    Posts:
    5
    a mi me sucedio que tampoco encontraba nada y lo que hize fue subir la aplicacion a Google Console como una aplicacion de Prueba interna para que estuviera disponoble en Google Play y de alli la descargue e instale en mi celular y funciono. Y asi es como le hago cuando quiero hacer las pruebas.

    ya que si solamnete lo instalo en el celular cuando quiero comprar me aparece el cartel de "Este producto no esta disponible"

    pero si la aplicacion la paso como Prueba Interna para que este en la Playstore y la instalo desde alli. Cuando le doy comprar me aparece ahora si poder hacer la compra con mi tarjeta de credito
     
  4. tuantruongminh

    tuantruongminh

    Joined:
    Feb 13, 2019
    Posts:
    15
    Thanks for your experience sharing. I tried to upload my game to internal test as well and test, but it still does not work. The IAP product id still unavailable
     
  5. tuantruongminh

    tuantruongminh

    Joined:
    Feb 13, 2019
    Posts:
    15
  6. Yannick_D

    Yannick_D

    Unity Technologies

    Joined:
    Feb 21, 2022
    Posts:
    218
    Hello,

    Based on the "Unavailable product" message, both the product id and the store specific product id are still not in lower case.
    If you are using codeless, double check in your catalog that the store specific id is in lower case.
    If you are using coded, make sure that your calls to AddProduct uses the lower case name.

    If this doesn't work, could you provide a screenshot and/or the code adding the products?

    Also, have you published your app into a new closed testing track on the Google Play Console?
    If not, follow these steps:
    https://docs.unity3d.com/Manual/UnityIAPGoogleConfiguration.html
     
  7. tuantruongminh

    tuantruongminh

    Joined:
    Feb 13, 2019
    Posts:
    15
    Hello Yannick. THanks for your answer.
    I used coded version and I did change the uppercase to lowercase. I dont use catalog.
    Indeed, I did not test the IAP in closed test.
    Here are screenshot of the code
    upload_2023-1-5_21-36-14.png
    upload_2023-1-5_21-36-54.png
    upload_2023-1-5_21-38-8.png
     

    Attached Files:

  8. tuantruongminh

    tuantruongminh

    Joined:
    Feb 13, 2019
    Posts:
    15
    This is how I code buying a product
    upload_2023-1-5_21-40-4.png
     
  9. Yannick_D

    Yannick_D

    Unity Technologies

    Joined:
    Feb 21, 2022
    Posts:
    218
    The code looks good, so this seems to be an issue between your app and the Google Play Store.
    Based on the error "NoProductsAvailable", it seems the Google Play Store is not returning any products.

    You will have to add a closed testing track if you want to test it, follow these instructions and it should work:
    https://docs.unity3d.com/Manual/UnityIAPGoogleConfiguration.html
     
  10. tuantruongminh

    tuantruongminh

    Joined:
    Feb 13, 2019
    Posts:
    15
    Hi @Yannick_Denis
    I have uploaded the latest game to a closed testing track, but the IAP is still not working.
    I initialize Unity Game services right at the time the game is launched as follows. Please check if there is anything not OK.
    void Awake()
    {

    Initialize(OnSuccess, OnError);
    }
    void Initialize(Action onSuccess, Action<string> onError)
    {
    try
    {
    var options = new InitializationOptions().SetEnvironmentName(k_Environment);
    UnityServices.InitializeAsync(options).ContinueWith(task => onSuccess());
    }
    catch (Exception exception)
    {
    onError(exception.Message);
    }
    }
    void OnSuccess()
    {
    var text = "Congratulations!\nUnity Gaming Services has been successfully initialized.";
    informationText.text = text;
    Debug.Log(text);
    }
    void OnError(string message)
    {
    var text = $"Unity Gaming Services failed to initialize with error: {message}.";
    informationText.text = text;
    Debug.LogError(text);
    }
    private void Start()
    {
    a = true;
    if (UnityServices.State == ServicesInitializationState.Uninitialized)
    {
    var text =
    "Error: Unity Gaming Services not initialized.\n" +
    "To initialize Unity Gaming Services, open the file \"InitializeGamingServices.cs\" " +
    "and uncomment the line \"Initialize(OnSuccess, OnError);\" in the \"Awake\" method.";
    informationText.text = text;
    Debug.LogError(text);
    }
    //InitializeSdk();
    //DontDestroyOnLoad(GameObject.Find("Yodo1AdCanvas"));
    }
     
  11. Yannick_D

    Yannick_D

    Unity Technologies

    Joined:
    Feb 21, 2022
    Posts:
    218
    The script seems good and even if that didn't work, IAP still functions without this, so that wouldn't be the issue.

    Have you also added your account to the License Testing and validated on your device's Google Play Store that it is the same account logged on?

    If that still doesn't work, could you post the following:
    -Screenshot of your Google Play Console products where the full Product ID is visible
    -Screenshot of one product details (View in-app product on the Google Play Console)
    -Unity log with the warnings for each Unavailable product
     
  12. tuantruongminh

    tuantruongminh

    Joined:
    Feb 13, 2019
    Posts:
    15
    Hello @Yannick_Denis
    My account is in the testing list and it is in the account in my Play Store in my mobile phone.

    Please take a look at the attached pictures.
     

    Attached Files:

  13. tuantruongminh

    tuantruongminh

    Joined:
    Feb 13, 2019
    Posts:
    15

    Attached Files:

  14. Yannick_D

    Yannick_D

    Unity Technologies

    Joined:
    Feb 21, 2022
    Posts:
    218
    Thank you for the screenshots!

    From what I can see, the problem is the name mismatch between the Google Play Store and IAP.
    On the Google Play Store, the product IDs are in lower case (org.game4everyone.rattunnelrevolution.meat), but on the IAP side, some characters are in upper case (org.Game4everyone.RatTunnelRevolution.meat).

    These have to match, otherwise IAP cannot associate the products with the ones returned from the Google Play Store.
     
  15. tuantruongminh

    tuantruongminh

    Joined:
    Feb 13, 2019
    Posts:
    15
    Hi @Yannick_Denis
    Actually, I did change the IDs to all lower cases months ago. Till now, the mismatch is still there. It seems Google Play did not accept the change.
    As far as I know, the uppercase is not allowed by Google Play.
    Can you please check further?
    upload_2023-1-21_7-1-13.png
     
  16. Yannick_D

    Yannick_D

    Unity Technologies

    Joined:
    Feb 21, 2022
    Posts:
    218
    In your screenshot "IAP 2.png", the "Unavailable product" warning still has upper case characters in the product ids.
    These are product IDs on the IAP side, so it seems there might be something changing your product IDs or the code above isn't being executed properly.
    Are your strings correctly named when calling the UnityPurchasing.Initialize?
    Do you have any catalogs that could also be adding products (Codeless IAP Catalog with the "Automatically initialize UnityPurchasing" or a call to SetCatalogProvider)?

    I can't see it in the screenshot, but do you still have the "NoProductsAvailable" message?
     
  17. tuantruongminh

    tuantruongminh

    Joined:
    Feb 13, 2019
    Posts:
    15
    Hi @Yannick_Denis

    Thanks a lot for your reply. Yes, I still have the no product available messages.
    I execute the UnityPurchasing.Initialize at the start . Furthermore, I deleted all items in IAP catalog.
    I did not find any Initialize Unity Purchasing or set catalog provider. I think it is in previous version.
    I am using Unity 2022.1.20f1

    upload_2023-1-24_8-5-55.png
    upload_2023-1-24_8-4-5.png
    upload_2023-1-24_8-0-24.png
     
    Last edited: Jan 24, 2023
  18. tuantruongminh

    tuantruongminh

    Joined:
    Feb 13, 2019
    Posts:
    15
  19. Yannick_D

    Yannick_D

    Unity Technologies

    Joined:
    Feb 21, 2022
    Posts:
    218
    The "Automatically initialize UnityPurchasing" can only be active if you have products in the catalog, so this is disabled in your case which is good.

    At this point, I would suggest adding some traces to validate that your product IDs are correct. Since your products are Serializable (via HideInInspector), they might be modified elsewhere in your project.

    1. Try adding a trace to see what your 5 product IDs are before Initialize is called:
    Code (CSharp):
    1. public void InitializePurchasing()
    2. {
    3.     var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
    4.     builder.AddProduct(food, ProductType.Consumable);
    5.     builder.AddProduct(meat, ProductType.Consumable);
    6.     builder.AddProduct(med, ProductType.Consumable);
    7.     builder.AddProduct(weapon, ProductType.Consumable);
    8.     builder.AddProduct(all, ProductType.Consumable);
    9.  
    10.     Debug.Log($"Products: {food} {meat} {med} {weapon} {all}");
    11.     UnityPurchasing.Initialize(this, builder);
    12. }

    2. Try replacing the variables with the correct string to see if the problem is the variables or if it's something else:
    Code (CSharp):
    1. public void InitializePurchasing()
    2. {
    3.     var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
    4.     builder.AddProduct("org.game4everyone.rattunnelrevolution.meat", ProductType.Consumable);
    5.     builder.AddProduct("org.game4everyone.rattunnelrevolution.food", ProductType.Consumable);
    6.     builder.AddProduct("org.game4everyone.rattunnelrevolution.medicine", ProductType.Consumable);
    7.     builder.AddProduct("org.game4everyone.rattunnelrevolution.weapon", ProductType.Consumable);
    8.     builder.AddProduct("org.game4everyone.rattunnelrevolution.all", ProductType.Consumable);
    9.  
    10.     UnityPurchasing.Initialize(this, builder);
    11. }
     
  20. tuantruongminh

    tuantruongminh

    Joined:
    Feb 13, 2019
    Posts:
    15
    Hi @Yannick_Denis
    I tried all this but they are both not working. What I do is that, I change the names of the variables, and now it is matching with the product id on Google Play. Do you know why it is happening?
    Now, I tested the IAP offline, it seems working. I have just uploaded the game to Google Play and wait for review
     
  21. Yannick_D

    Yannick_D

    Unity Technologies

    Joined:
    Feb 21, 2022
    Posts:
    218
    If you fixed all the product ids, then I recommend redoing the steps from this:
    https://docs.unity3d.com/Manual/UnityIAPGoogleConfiguration.html

    Once your game passes the review, could you test it again to see if it works?
    If it still doesn't, can you provide the log with this new build?

    I also noticed that you have "Multi-quantity" ticked in the Google Play Console. This is currently not supported by Unity IAP, so I would recommend removing that.
     
  22. tuantruongminh

    tuantruongminh

    Joined:
    Feb 13, 2019
    Posts:
    15
    Hi Yannick. It works fine. I will remove the Multi quantity in the Google Play console
     
    Yannick_D likes this.