0

I have implemented the google inapp product created from the api on the fly when I have to make purchase. Here is the python code.

 body = {
            "sku":order.sku,
            "packageName":PACKAGE_NAME,
            "purchaseType": "managedUser",
            "status":"active",
            "listings": {"en-US": {
                "title": order.title, "description": order.description
                }
            },
            "defaultPrice": {"priceMicros": str(int(order.price * 1000000)), "currency": "USD"}
        }

    result = google_api_service.inappproducts().insert(body=body, packageName=PACKAGE_NAME).execute()

Inapp product created on console correctly and then I try to query the product from app, it doesn't show on skuDetailList.

questionOrderResult.sku?.let {

        val skuList = ArrayList<String>()
        skuList.add(it)
        val params = SkuDetailsParams.newBuilder()
        params.setSkusList(skuList).setType(BillingClient.SkuType.INAPP)

        uiScope.launch {
            val skuDetailsResult = billingClient.querySkuDetails(params.build())
            Timber.i("sku List -->$skuDetailsResult")
            skuDetailsResult.let { result ->
                val billingResult = result.billingResult
                val skuDetailsList = result.skuDetailsList
                Timber.d(result.toString())
                if (billingResult.responseCode == BillingClient.BillingResponseCode.OK && !skuDetailsList.isNullOrEmpty()) {
                    for (skuDetails in skuDetailsList) {
                        updateUI(skuDetails)
                    }
                }
            }

        }

    }

After searching on web I found out that google play app cache is have to clear each time to get my skudetail. Is there any other solution that I get the skudetail without clearing google play cache every time ?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.