“subs”类型的项目不能被使用。 回应:-1010:消费尝试无效
我正在尝试在应用程序中购买我的应用程序第一次,我得到这个错误。 付款成功完成,并成功消息后发生此错误。
请帮我解决这个问题。
提前致谢。
请检查这个代码
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent) { if (!mHelper!!.handleActivityResult(requestCode, resultCode, data)) { super.onActivityResult(requestCode, resultCode, data) } } fun buyClick(view: View) { mHelper!!.launchSubscriptionPurchaseFlow(this, ITEM_SKU, 10001, mPurchaseFinishedListener, "mypurchasetoken") } var mPurchaseFinishedListener: IabHelper.OnIabPurchaseFinishedListener = IabHelper.OnIabPurchaseFinishedListener { result, purchase -> Log.e(TAG, result.toString()) if (result.isFailure) { // Handle error Log.e(TAG, "failed") return@OnIabPurchaseFinishedListener } else if (purchase.sku == ITEM_SKU) { consumeItem() buyButton!!.isEnabled = false } } fun consumeItem() { mHelper!!.queryInventoryAsync(mReceivedInventoryListener) } var mReceivedInventoryListener: IabHelper.QueryInventoryFinishedListener = IabHelper.QueryInventoryFinishedListener { result, inventory -> if (result.isFailure) { // Handle failure Log.e(TAG, "failure") } else { mHelper!!.consumeAsync(inventory.getPurchase(ITEM_SKU), mConsumeFinishedListener) } } var mConsumeFinishedListener: IabHelper.OnConsumeFinishedListener = IabHelper.OnConsumeFinishedListener { purchase, result -> Log.e(TAG, result.toString()) if (result.isSuccess) { clickButton!!.isEnabled = true Log.e(TAG, "In-app Billing setup ") } else { // handle error Log.e(TAG, "In-app Billing setup failed") } }