I have the latest billing version 6.0.1
This is the function to get the item prices:
private fun getPriceSingle(productId: String, priceText: TextView){
val queryProductDetailsParams =
QueryProductDetailsParams.newBuilder()
.setProductList(
ImmutableList.of(
QueryProductDetailsParams.Product.newBuilder()
.setProductId(productId)
.setProductType(BillingClient.ProductType.SUBS)
.build()))
.build()
billingClient.queryProductDetailsAsync(queryProductDetailsParams) { billingResult, productDetailsList ->
when (billingResult.responseCode) {
BillingClient.BillingResponseCode.OK -> {
when (productId) {
"no_ads_one_week_de" -> {
detailsWeek = productDetailsList[0]
}
"no_ads_one_month_de" -> {
detailsMonth = productDetailsList[0]
}
"no_ads_one_year_de" -> {
detailsYear = productDetailsList[0]
}
}
val price = productDetailsList[0].subscriptionOfferDetails?.get(0)?.pricingPhases!!.pricingPhaseList[0]?.formattedPrice.toString()
priceText.text = price
if(detailsWeek != null && detailsMonth != null && detailsYear != null){
allPricesSet = true
binding.loadingPanelVip.visibility = View.GONE
}
}
BillingClient.BillingResponseCode.FEATURE_NOT_SUPPORTED -> {
Toasty.success(this@GetPremium, "Billing is not supported on this device", Toast.LENGTH_LONG, true).show()
finish()
}
BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED -> {
Log.d("pikaboo", "owned")
premiumActivate()
}
else -> {
getPriceSingle(productId, priceText)
}
}
}
}
After I've purchased and acknowledget one of them the items, I can see it in the subscriptions in the google play account.
Now when I call the function again to request the same item price, the BillingClient.BillingResponseCode.ITEM_ALREADY_OWNED
condition doesn't get executed
Why is that and how to fix?