Testingのロゴ

Testing

組織
RevenueCat
testing

Use this skill when testing a Google Play Billing integration. Covers license test accounts, static test responses, Play Console sandbox purchases, and subscription lifecycle acceleration for renewals, grace period, and account hold.

Add to TypingMind

概要

公開者RevenueCat
リポジトリplay-billing-skills
スキル名testing
スター
58
フォーク
0
同梱ファイル
指示のみ
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    RevenueCatがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Testing」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/testing
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/RevenueCat/play-billing-skills.git /tmp/play-billing-skills
mkdir -p .claude/skills
cp -r /tmp/play-billing-skills/google-play/testing .claude/skills/testing
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでTestingを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にTestingを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Testingは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Testing Your Play Billing Integration

A billing build that runs on your laptop is not evidence that it works in production. Real users hit payment declines, pending cash payments, grace periods, and account holds. Use Google's license testers, Play Billing Lab, and the accelerated sandbox to exercise every state you claim to support before you release.

Phase 1: Discovery

Before you test anything, confirm the environment is wired up. Skipping a step here leads to purchase dialogs that charge real money or flows that never show test cards.

Run through this checklist:

  • License testers list: Play Console -> Settings -> License testing. The Gmail you test with must appear here. Testers are set at the developer account level, apply to every app you own, and propagate within minutes.
  • Test track upload: Your APK or AAB must sit on internal, closed, or open testing. The license tester benefit only activates after you have uploaded the app at least once. Internal testing ships in minutes and is the right default for billing work.
  • Signed in account: The license tester account must be on the test device. With several accounts, the purchase uses the account that downloaded the app, or the first account on the device if none did (for example a sideloaded debug build). Expand the purchase dialog to confirm which account is paying.
  • Play Billing Lab installed: Install the Play Billing Lab companion app from the Play Store on the test device. You need it for country overrides, trial resets, state transitions, and the response simulator.
  • enablePendingPurchases: every BillingClient that sets a purchases listener must call enablePendingPurchases(PendingPurchasesParams.newBuilder().enableOneTimeProducts().build()), or build() throws. Add enablePrepaidPlans() only if you sell prepaid plans and handle pending prepaid purchases.

If any item is missing, fix that first. License tester tooling is invisible otherwise.

Phase 2: Plan

Pick a strategy that matches what you changed. Running all 11 subscription test cases on every PR is wasteful. Running none is reckless.

Change typeMinimum coverage
New purchase flow or product catalogNew purchase, acknowledgment, entitlement grant
Subscription lifecycle logicRenewal, grace period, account hold, cancellation
Plan change or upgrade codeEach replacement mode you support, plus linkedPurchaseToken handling
RTDN or server integrationRenewal, grace, hold, revoke, refund notifications end to end
Error handling or retry pathsResponse simulator sweep: NETWORK_ERROR, ITEM_ALREADY_OWNED, USER_CANCELED, BILLING_UNAVAILABLE; for a lost service connection, force stop the Play Store app while connected
Pre release candidateFull 11 case suite plus one real payment on the cheapest SKU

Test product static responses

Inside the Play purchase dialog, license testers see five virtual instruments instead of real cards. Each one forces a deterministic outcome, so pick the one that matches the path you want to exercise.

Test instrumentResultUse when you are testing
Test card, always approvesImmediate success, BillingResponseCode.OKHappy path, acknowledgment, entitlement grant
Test card, always declinesImmediate failure, BillingResponseCode.ERRORDecline UI, error messaging, absence of entitlement grant
Slow test card, approves after a few minutesPending state, then success after minutesPending purchase handling, UI state, PurchasesUpdatedListener firing twice
Slow test card, declines after a few minutesPending state, then final failurePending decline path, cleanup of pending UI
Test card, approves then charges backSuccess, then a simulated chargeback initiated by the userChargeback and refund review handling, PendingRefundReviewNotification RTDN

Before you pick an instrument, decide what signal proves the test passed: a specific response code, a purchase state transition, an RTDN on your server, or an entitlement change in the app. Write it down first.

Pick a lifecycle scenario

If you are exercising the subscription state machine, choose one of these as your first target:

  • Renewal succeeds: cheapest scenario, verifies RTDN plumbing.
  • Grace period enter and recover: verifies you keep access up during grace and re grant after recovery.
  • Account hold enter and recover: verifies you revoke access during hold and restore after payment fix.
  • Pause and resume: only if your product allows pausing.
  • Upgrade with replacement mode: verifies linkedPurchaseToken handling on the server (the app only sees the new purchase token).

Phase 3: Execute

Step 1: Run a sandbox purchase

Open your app on the test device signed in with the license tester account.

  1. Trigger your normal product list query. Confirm prices render and the product appears.
  2. Launch the billing flow. Expect the Play purchase sheet to show the five test instruments rather than real cards.
  3. Pick "Test card, always approves".
  4. Confirm PurchasesUpdatedListener fires with BillingResponseCode.OK and a Purchase in the PURCHASED state.
  5. Acknowledge the purchase from your server or client path.
  6. Call queryPurchasesAsync and confirm the purchase is returned as active.
  7. Confirm your app grants the matching entitlement.

To prove your acknowledgment path works, repeat the flow but skip step 5 on purpose:

  1. Make the purchase.
  2. Do not acknowledge.
  3. Wait 3 minutes.
  4. Re query purchases and confirm Google has auto refunded and the entitlement is gone.

If the entitlement is still present after 3 minutes, your app is caching state without rechecking. Fix that before shipping.

Step 2: Accelerate the subscription lifecycle

Test subscriptions run on a compressed schedule automatically. You do not configure this.

Production renewal periodTest renewal period
Weekly5 minutes
Monthly5 minutes
Quarterly10 minutes
Semi annual15 minutes
Yearly30 minutes

Intermediate states compress too: free trial runs 3 minutes, grace period runs 5 minutes, account hold runs 10 minutes. Test subscriptions cancel after 6 renewals regardless of period, so plan accordingly.

To watch a full lifecycle in under 20 minutes:

  1. Start a new monthly subscription using the always approves test card.
  2. Wait 5 minutes for the first renewal. Confirm your server receives an RTDN with SUBSCRIPTION_RENEWED and the entitlement remains active.
  3. Open Play Billing Lab and trigger a payment failure at the next renewal.
  4. Verify the subscription enters grace period and your app still grants access.
  5. Wait 5 minutes. Grace expires, the subscription moves to account hold, your app revokes access.
  6. Wait 10 minutes. Account hold expires and the subscription cancels.
  7. Confirm RTDNs for SUBSCRIPTION_IN_GRACE_PERIOD, SUBSCRIPTION_ON_HOLD, and SUBSCRIPTION_CANCELED each landed.

Use Play Billing Lab to force specific transitions instead of waiting on timers when you only need to verify one state. It also lets you reset trial eligibility so you can rerun trial sign up on the same account.

Step 3: Exercise error paths with the response simulator

Play Billing Lab ships a response simulator that overrides the BillingResult of launchBillingFlow, acknowledgePurchase, consumeAsync, and queryProductDetailsAsync with a chosen positive response code. It cannot return negative codes such as SERVICE_DISCONNECTED, and it does not drop the service connection. Configure a rule, run the flow, confirm your app recovers.

Opt the test build in (PBL 7.1.1+), in a debug or test manifest only:

xml
<meta-data android:name="com.google.android.play.largest_release_audience.NONPRODUCTION" android:value="" />
<meta-data android:name="com.google.android.play.billingclient.enableBillingOverridesTesting" android:value="true" />

Open Play Billing Lab before your app, and confirm the Play Billing Lab status bar icon shows the connection.

Minimum response codes to cover:

  • Lost service connection (not simulated: force stop the Play Store app while connected): your app reconnects on the next call and retries.
  • NETWORK_ERROR on acknowledgePurchase: your app retries, because unacknowledged purchases refund in 3 days in production.
  • ITEM_ALREADY_OWNED on launchBillingFlow: your app refreshes purchases and messages the user correctly.
  • USER_CANCELED: your app returns to the previous screen without an error banner.
  • BILLING_UNAVAILABLE on connect: your app hides purchase options gracefully.

Step 4: Enable pending purchases

Pending purchases are mandatory for one time products. Configure your client once and then test with the slow approve card.

kotlin
val billingClient = BillingClient.newBuilder(context)
    .setListener(purchasesUpdatedListener)
    .enablePendingPurchases(
        PendingPurchasesParams.newBuilder()
            .enableOneTimeProducts()
            // .enablePrepaidPlans() // only if you sell prepaid plans and handle pending prepaid purchases
            .build()
    )
    .build()

Guard entitlement grants by purchase state:

kotlin
when (purchase.purchaseState) {
    Purchase.PurchaseState.PURCHASED -> grantAndAcknowledge(purchase)
    Purchase.PurchaseState.PENDING -> showPendingUi(purchase)
    else -> Unit
}

Verify the pending to purchased transition delivers a second PurchasesUpdatedListener callback (or appears in queryPurchasesAsync() on resume), that a declined slow card never grants access after an app restart, and that your server processes ONE_TIME_PRODUCT_PURCHASED/SUBSCRIPTION_PURCHASED or ONE_TIME_PRODUCT_CANCELED/SUBSCRIPTION_PENDING_PURCHASE_CANCELED.

Step 5: One real payment before production

License tester cards do not exercise 3D Secure prompts, card verification, refund processing, or financial reporting. Before your first production push:

  1. Make one real purchase on your cheapest product using an account on your internal test track.
  2. Request a refund through Google Play. Verify the refund RTDN arrives and your app revokes access.
  3. Confirm the purchase and refund both appear in Play Console financial reports.

Common mistakes

  • Caching entitlements locally without revalidating against queryPurchasesAsync. The 3 minute auto refund window exposes this.
  • Granting access during PENDING state. The slow decline card exposes this.
  • Treating a restored subscription as a new purchase after a user cancels and resubscribes inside the same period.
  • Using CHARGE_PRORATED_PRICE on a downgrade. It will fail at runtime.
  • Revoking access the moment the user cancels, instead of at period end.
  • Revoking access during grace period, which is meant to preserve access while Google retries payment.

References

よくある質問

AIスキル「Testing」では何ができますか?

Use this skill when testing a Google Play Billing integration. Covers license test accounts, static test responses, Play Console sandbox purchases, and subscription lifecycle acceleration for renewals, grace period, and account hold.

TypingMindでTestingを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Testingはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにTestingをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/testingを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Testingを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Testingで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもTestingを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Testing」は無料ですか?

はい。RevenueCatがApache-2.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇