【问题标题】:How to remove test IAP purchase from Android Google Play如何从 Android Google Play 中删除测试 IAP 购买
【发布时间】:2015-02-26 03:02:10
【问题描述】:

我设置了一个测试版帐户来测试我正在开发的谷歌应用程序的 IAP,我遇到的问题是,一旦我购买了一次性产品(非经常性费用)测试 IAP,我就无法'删除它' 因此,所以现在,即使我删除应用程序并重新安装,它也会记住购买,这在现实世界中对用户来说很棒,但在尝试修复错误时却不是很好!

有什么方法(除了创建大量 gmail 帐户来测试)从帐户中删除购买吗?

【问题讨论】:

    标签: android google-play in-app-purchase in-app-billing


    【解决方案1】:

    这是一个老问题,但如果有人仍在寻找解决方案,请转到:

    您可以在此处退款/取消测试购买。然后使用此命令清除购买状态:

    adb shell pm clear com.android.vending

    【讨论】:

    • 对我不起作用 - 我仍然必须在应用程序中“消费”购买。甚至清除 Google Play Store 应用的缓存和数据也没有用。
    • 谢谢,当我记得你还说要运行 adb shell 命令时,它对我有用。需要注意的一件事是,通过 Google Play 控制台退款需要很长时间才能处理,而且我执行这两个命令时相隔数小时。下次我会在 Play Console 退款后立即运行 adb,看看 Play Console 进程等待时间是否多余,我希望这是真的,因为这只会让通过 playstore 测试应用程序的时间更长。
    • 好吧,它并没有真正工作,虽然它是,但它不是。当我运行 adb 命令时,购买被删除,我的应用程序又回到了非购买状态,这很好。但只要应用调用 BillingClient.queryPurchases,Playstore 就会显示该产品已购买,而我的应用会返回购买状态。
    • 当我的设备需要退款时,我发现选中了对话框中显示的“撤销”复选框,以使我的设备意识到它已被完全取消!
    • 对我也不起作用.. 清除 Google Play 数据 && 缓存,运行 adb shell pm clear com.android.vending 并在 Google Play 控制台上退款(一段时间后获得“退款”标签)仍然收到错误声明 Item already owned尝试运行consume()(幸运地保存了响应中的数据)但没有运气帮助
    【解决方案2】:

    我知道的唯一方法是在您的应用中强制消费。然后您可以删除该代码。

    【讨论】:

      【解决方案3】:

      我正在使用 Cordova 的 cc.fovea.cordova.purchase 插件来管理我的 IAP 购买。为了让我的测试非消耗品被删除,我将我的注册从非消耗品更改为消耗品。

      store.register({
            id: this.predatorID,
            alias: 'Predator Pack',
            type: store.CONSUMABLE //store.NON_CONSUMABLE
          });
      

      另外,显然还有reserved keywords you could use instead(如果你喜欢的话)。 - https://developer.android.com/google/play/billing/billing_testing.html

      【讨论】:

        【解决方案4】:

        我遇到了同样的情况并开始研究。不幸的是,这里给出的指示并没有产生解决方案。

        我想分享对我有用的解决方案。

        如果你在正确的地方调用下面的方法,就会产生解决方案。来源:Link

        /**
             * Recall that Google Play Billing only supports two SKU types:
             * [in-app products][BillingClient.SkuType.INAPP] and
             * [subscriptions][BillingClient.SkuType.SUBS]. In-app products are actual items that a
             * user can buy, such as a house or food; subscriptions refer to services that a user must
             * pay for regularly, such as auto-insurance. Subscriptions are not consumable.
             *
             * Play Billing provides methods for consuming in-app products because they understand that
             * apps may sell items that users will keep forever (i.e. never consume) such as a house,
             * and consumable items that users will need to keep buying such as food. Nevertheless, Google
             * Play leaves the distinction for which in-app products are consumable entirely up to you.
             *
             * If an app wants its users to be able to keep buying an item, it must call
             * [BillingClient.consumeAsync] each time they buy it. This is because Google Play won't let
             * users buy items that they've previously bought but haven't consumed. In Trivial Drive, for
             * example, consumeAsync is called each time the user buys gas; otherwise they would never be
             * able to buy gas or drive again once the tank becomes empty.
             */
        
            private fun clearIapHistory() {
                    billingClient!!.queryPurchases(BillingClient.SkuType.INAPP).purchasesList
                        .forEach {
                            val params =
                                ConsumeParams.newBuilder().setPurchaseToken(it.purchaseToken).build()
                            billingClient!!.consumeAsync(params) { responseCode, purchaseToken ->
                                when (responseCode.responseCode) {
                                    BillingClient.BillingResponseCode.OK -> {
        
                                    }
                                    else -> {
                                        Log.w(LOG_TAG, responseCode.debugMessage)
                                    }
                                }
                            }
                        }
                }
        

        【讨论】:

          【解决方案5】:
          if (inventory.getPurchase(ITEM_SKU) != null ) {
                          try {
                              mIabHelper.consumeAsync(premiumPurchase, new IabHelper.OnConsumeFinishedListener() {
                                  @Override
                                  public void onConsumeFinished(Purchase purchase, IabResult result) {
                                      Toast.makeText(MainActivity.this, "Consumed the test purchase successfully", Toast.LENGTH_SHORT).show();
                                  }
                              });
                          } catch (IabHelper.IabAsyncInProgressException e) {
                              e.printStackTrace();
                          }
                       }
          

          但是,refund() 和 revoke() 方法不支持测试购买,您只剩下 consumeAsync() 选项。

          【讨论】:

            【解决方案6】:

            只是:

            Purchase unlockedPurchase = inventory.getPurchase(SKU_UNLOCKED);
            // Log unlockedPurchase.getOrderId();
            

            转到您的 Google Play 面板,订单管理,查找该订单 ID 并退款(如果是您自己的订单,则应显示测试订单)。

            【讨论】:

              【解决方案7】:

              我想唯一可行的方法是……

              吃掉它!

              如需更多信息,请访问消费文档并搜索“consume”:https://developer.android.com/google/play/billing/integrate

              以下是对您来说重要的步骤:

              1. 依赖设置。
              2. 计费客户端连接。
              3. 查询购买。
              4. 消费(购买)。

              祝你好运~

              【讨论】:

                【解决方案8】:

                我遇到了类似的问题。幸运的是,我正在使用的应用程序是基于 WebView 的,因此我可以轻松地注入一个链接或按钮来触发一些 Javascript 以回调到应用程序中以使用测试订单。由于测试订单的orderId 有一个空字符串,因此很容易识别它们以使用它们。一旦消耗,该项目可以再次“购买”。移除按钮需要注释掉一行代码但是如果按钮意外进入最终发布的应用程序,它不会造成任何问题,因为代码只消耗测试订单 - 即不影响实际订单。该按钮只会令人尴尬而不是灾难。

                我正在使用没有关联信用卡的设备。我设置了一些促销代码并为我的测试订单使用“兑换代码”选项。促销代码不会导致货币易手的风险,而且我可以使用真实产品在我的应用中完全验证 IAB 功能,而无需求助于 IAB 测试代码。

                根据 Martin Kool 的帖子,Google 电子钱包中没有显示任何内容。

                【讨论】:

                  【解决方案9】:

                  Test non-consumable products

                  要对同一个非消耗品进行多次测试购买,您可以使用 Google Play 管理中心退款和撤消购买。

                  【讨论】:

                    【解决方案10】:

                    Google Play 购买存储在 Google 电子钱包中。

                    https://wallet.google.com

                    签名后,转到左侧的“交易”。可以从那里取消测试购买。

                    【讨论】:

                      猜你喜欢
                      • 2021-01-10
                      • 2012-12-01
                      • 1970-01-01
                      • 1970-01-01
                      • 1970-01-01
                      • 2016-11-15
                      • 2021-01-17
                      • 1970-01-01
                      • 1970-01-01
                      相关资源
                      最近更新 更多