web-dev-qa-db-ja.com

テストIAP購入をAndroid GooglePlayから削除する方法

私が取り組んでいるグーグルアプリのIAPをテストするためにベータアカウントを設定しました、私が抱えている問題は、一度だけの製品(非定期的な料金)を購入した後、テストIAPを「削除」できないことです、だから今、私がアプリを削除して再インストールしても、それは購入を記憶します、それはユーザーにとって現実の世界では素晴らしいですが、バグを修正しようとするときは素晴らしいことではありません!

アカウントから購入を削除する方法はありますか(テストするために大量のGmailアカウントを作成する以外に)ありますか?

20
Hypergater

これは古い質問ですが、誰かがまだ解決策を探している場合は、次のURLにアクセスしてください。

そこで、購入をテストして払い戻し/キャンセルすることができます。次に、次のコマンドを使用して購入状態をクリアします。

adb Shell pm clear com.Android.vending

18
Bero

私が知っている唯一の方法は、アプリで強制的に消費することです。その後、そのコードを削除できます。

7
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()オプションのみが残ります。

2
LokiDroid

私はIAP購入を管理するために、cordova用の cc.fovea.cordova.purchase プラグインを使用しています。テストの非消耗品を削除するために、登録を非消耗品から消耗品に変更しました。

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

また、どうやら 代わりに使用できる予約済みのキーワード (それに興味がある場合)があります。 - https://developer.Android.com/google/play/billing/billing_testing.html

1
James L.

私は同じ状況に遭遇し、研究を始めました。残念ながら、ここで行われた指示は解決策を生み出しませんでした。

私のために働いた解決策を共有したいと思います。

以下のメソッドを適切な場所で呼び出すと、ソリューションが生成されます。ソース: リンク

/**
     * 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)
                            }
                        }
                    }
                }
        }
0
Arda Kazancı

同様の問題がありました。幸い、私が使用しているアプリはWebViewベースであるため、リンクまたはボタンを簡単に挿入してJavascriptをトリガーし、アプリケーションにコールバックしてテスト注文を消費することができます。テストオーダーにはorderIdの空の文字列があるため、それらを消費するためにそれらを識別するのは簡単です。一度消費されると、アイテムは再び「購入」することができます。ボタンを削除するには、コードの1行をコメントアウトする必要がありますが、ボタンが誤って最終的に公開されたアプリになった場合、コードはテストオーダーのみを消費するため、問題は発生しません。つまり、実際のオーダーは影響を受けません。そのボタンは、災害ではなく恥ずかしいだけです。

クレジットカードが関連付けられていないデバイスで作業しています。いくつかのプロモーションコードを設定し、テスト注文に[コードを利用]オプションを使用します。プロモーションコードを使用すると、お金を交換するリスクがなくなり、IABテストコードを使用しなくても、アプリのIAB機能を実際の製品で完全に検証できます。

Martin Koolの投稿によると、Googleウォレットには何も表示されません。

0
Kyle Berger

ただ:

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

Google Playパネルの[注文管理]に移動し、その注文IDを探して払い戻します(自分の注文の場合は[注文のテスト]と表示されます)。

0
Ferran Negre