Google Play Billing: Unable to query certain products from Play Console
M

0

2

I'm trying to query all my in-app products using the GooglePlay Billing library but the skuDetailsList in querySkuDetailsAsync() seem to only show some products listed in the Play Console. And by some, I mean, it's only displaying those products that are directly added via the Console. BUT that's not how I want to add my products. Instead, I want to do it dynamically by using the AndroidPublisher library using the inappproducts.insert method. So far, I am able to successfully insert products to Play Console via this library BUT upon trying to query all my products, using querySkuDetailsAsync() in the client app, only those products that I had specifically added via the library doesn't show up in app for some very strange reason! I have added all my in-app product IDs to an array list and I've also tested and made sure that the product IDs are correct (matches the one in Google Play Console). Moreover, all my products are active and my app has already been published so it should work.

However, from what I have observed, only those products that I added directly from Play Console seem to get added to the skuDetailsList while the ones I inserted via the Android Publisher library doesn't load in app even though it's active and listed in the Play Console which is pretty odd. Here's a reference to the code I used for the client app.

SkuDetailsParams params = SkuDetailsParams.newBuilder()
                        .setType(INAPP)
                        .setSkusList(skuList)
                        .build();

billingClient.querySkuDetailsAsync(params,
            (billingResult, skuDetailsList) -> {
                System.out.println("size:"+skuDetailsList.size());
                if (billingResult.getResponseCode() != BillingClient.BillingResponseCode.OK) {
                    System.out.println(String.format("Unable to query sku details: %d - %s", billingResult.getResponseCode(), billingResult.getDebugMessage()));
                } else {
                    for (SkuDetails details: skuDetailsList) {
                        System.out.println("title -> "+details.getTitle());
                        System.out.println("description -> "+details.getDescription());
                        System.out.println("price -> "+details.getPrice());
                    }

                    setRecyclerView(skuDetailsList);
                }
            });

And this is the code I used to insert products to Google Play Console dynamically.

//insert new product
    InAppProductListing listing = new InAppProductListing();
    listing.setTitle("my product");
    listing.setDescription("this is a description");
    Map<String,InAppProductListing> mapListing = new HashMap<String, InAppProductListing>();
    mapListing.put("en-GB", listing);

    Inappproducts inappproducts = pub.inappproducts();
    InAppProduct product = new InAppProduct();
    product.setDefaultLanguage("en-GB");
    product.setPackageName(packageName);
    product.setSku(productID);
    product.setPurchaseType("managedUser");
    product.setListings(mapListing);
    Price price = new Price();
    price.setCurrency("INR");
    price.setPriceMicros("50000000");
    product.setDefaultPrice(price);
    product.setStatus("active");
            
    try {
        inappproducts.insert(product.getPackageName(), product).setAutoConvertMissingPrices(true).execute();
        System.out.println("Success");
    } catch (Exception e) {
        // TODO: handle exception
    }

It's been so long and I can't seem to find any resources/documentation on this issue. I've noticed that the products added via code seems to show up only hours later but the ones added from Console loads at once. Is this an issue with my code or could it, instead, be some issue with the library? Would really appreciate some help/advice on this issue!

Mastoid answered 21/2, 2021 at 5:46 Comment(5)
I have created an issue on Google Issue Tracker regarding this problem. Please star it if this issue affects any of you.Mastoid
did you manage to make the new in app product on store using above code ? i cannot find to which package InAppProductListing, Inappproducts classes belongs to ?Norling
Yes, the above code works such that I am able to upload the product to Play Console but it doesn't show up in-app immediately for some odd reason.Mastoid
@BilalShahid Did you implement this package -com.google.api.services.androidpublisher.model?Mastoid
@Mastoid Did this problem get resolved and does it work now?Octogenarian

© 2022 - 2024 — McMap. All rights reserved.