anjlab/android-inapp-billing-v3

getSubscriptionListingDetailsAsync error 'product id mismatch with Product type'

Opened this issue · 10 comments

I'm getting a product id mismatch with Product type error when using getSubscriptionListingDetailsAsync method.
I re checked PRODUCT_ID in my google play dashboard and is the same.

Inside onSkuDetailsResponse I call to showToast(products != null ? products.toString() : "Failed to load subscription details"); and I get '[]'

Can anyone help with this issue? It seems like the getSubscriptionListingDetailsAsync is waiting for purchase id instead a subscription id.

@serggl @Equin

Thanks

just checked it using this library from the maven central and it works just fine

just checked it using this library from the maven central and it works just fine

I keep trying to solve the issue without success. I appreciate if you can take a look into my code, maybe you can see what I'm coding wrong.

-BillingProcessor Initialization

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    bp = new BillingProcessor(this, getResources().getString(R.string.license_id), this);
    bp.initialize();

-Getting Suscription details (title, price..)

    bp.getSubscriptionListingDetailsAsync("suscription_id_test", new BillingProcessor.ISkuDetailsResponseListener() {
        @Override
        public void onSkuDetailsResponse(@Nullable List<SkuDetails> products) {
            Log.d("MYLOG", "Details ok!");
            Log.d("MYLOG", products.get(0).title + products.get(0).priceText);
        }

        @Override
        public void onSkuDetailsError(String error) {
            Log.d("MYLOG", "Details error");
        }
    });

Before retieving suscription details I get true in bp.isConnected() method.

I always get 'products' array as empty, dont know why.

License_id is correct, suscription_id is also correct as listed in my google play dashboard.

Thanks for your help

Hi, how is this issue solved? thanks.
push apk to Google play to test, it's right?

Hi @oceanox @serggl @superoidlau,

I'm also facing same issue and uploaded APK as internal tester. Still the problem persist. Is there any solution for this?

@AasthaDoshi
My understanding is that this apk needs to be reviewed by Google play and released.
Has your apk been released yet?

Hi @superoidlau, Nope it is not released and only uploaded as internal tester. So basically it has to be deployed on production right? As below methods does not work for me. Did that solved your issue?

private fun purchaseSubscription(productId: String) {
        if (BillingProcessor.isIabServiceAvailable(this)) {
            billingProcessor!!.subscribe(this, productId.checkString())
        } else {
            showToast("Billing service unavailable")
        }
    }
private fun fetchSubscriptionPrices() {
       try {
           billingProcessor?.getSubscriptionsListingDetailsAsync(
               arrayListOf(MONTHLY_ID, YEARLY_ID),
               object : ISkuDetailsResponseListener{
                   override fun onSkuDetailsResponse(products: MutableList<SkuDetails>?) {
                       Timber.i("Products_Received: ${Gson().toJson(products)}")
                       if (!products.isNullOrEmpty()) {
                           for (skuDetails in products) {
                               when (skuDetails.productId) {
                                   MONTHLY_ID -> {
                                       monthlyPrice =
                                           "${skuDetails.currency} ${skuDetails.priceText}"
                                   }

                                   YEARLY_ID -> {
                                       yearlyPrice =
                                           "${skuDetails.currency} ${skuDetails.priceText}"
                                   }
                               }
                           }
                           // Update UI with prices
                           updateSubscriptionButtonUI()
                       } else {
                           runOnUiThread {
                               showToast("Error fetching prices")
                           }
                       }
                   }

                   override fun onSkuDetailsError(error: String?) {
                       runOnUiThread {
                           showToast("Error fetching prices: ${error.toString()}")
                       }
                   }

               })
       } catch (e: Exception) {
           runOnUiThread {
               showToast("Error fetching prices: ${e.message}")
           }
       }
   }

@AasthaDoshi
My app is currently being reviewed.
Wait for Google play review and release, you will get the product information.
My current problem is the same as yours, which also returns an empty list.

image

@serggl , Let me know once it get reviewed from play store whether it works fine or not. Thanks!

@AasthaDoshi
After released, you can pull up the payment normally.

Hi @superoidlau, I've released my app in beta version still no hope for me and I'm getting empty data. Any insights?