Billing Response Codesのロゴ

Billing Response Codes

組織
RevenueCat
billing-response-codes

Use this skill as a reference lookup for every Play Billing Library BillingResponseCode and sub response code, with description, category, and handling guidance. Grounded in PBL 9.x.

Add to TypingMind

概要

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

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

  • どのLLMでも利用可能

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

  • 指示だけで完結

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

  • オープンソース

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

インストール

AIスキル「Billing Response Codes」を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/billing-response-codes
  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/billing-response-codes .claude/skills/billing-response-codes
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

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

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

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

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

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

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

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

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

スキルの指示

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

Billing Response Codes

Phase 0: Intent

Use this skill when you need to look up the meaning, category, or handling strategy for a value returned by BillingResult.getResponseCode() or BillingResult.getOnPurchasesUpdatedSubResponseCode() in the Play Billing Library. This reference covers:

  • All BillingResponseCode constants defined in PBL 9.x (the constant set is unchanged from PBL 8.x; v9 added no codes and removed none).
  • All OnPurchasesUpdatedSubResponseCode constants added in PBL 8.0.
  • Retry eligibility for each code.
  • The recommended response strategy per code.
  • A decision tree that maps any received code to an action.

Use this skill to answer questions like "what does response code 7 mean", "should I retry on SERVICE_UNAVAILABLE", or "how do I handle ITEM_ALREADY_OWNED".

Do not use this skill to author new integration code from scratch. Use the launch or purchase flow skills for that. This skill is a lookup table.

Phase 1: Locate

The authoritative copy of the tables and decision tree lives in the full appendix on revenuecat.com. When a question asks for:

  • The literal integer value of a code, see "Response Codes".
  • Sub response codes introduced in PBL 8.0, see "Sub Response Codes (PBL 8.0+)".
  • The retry strategy for a code, see "Retry Implementation Summary".
  • A full flow from received code to action, see "Error Handling Decision Tree".

The tables reproduced below in Phase 2 mirror the appendix verbatim so you can answer most lookups without opening the chapter.

Phase 2: Reference Tables

BillingResponseCode values

CodeValueRetriableDescriptionRecommended Strategy
OK0N/AOperation succeededProcess the result normally.
USER_CANCELED1NoUser dismissed the purchase dialog. Since PBL 8.3 also returned when the user left to pay in an external app (e-wallet) and did not return (debug message BILLING_ACTIVITY_PAUSED; ERROR before 8.3).No action needed. Do not show an error message.
SERVICE_UNAVAILABLE2YesGoogle Play service is temporarily unavailableRetry with exponential backoff (2s base, 2x factor, max 3 attempts).
BILLING_UNAVAILABLE3No (auto)Billing is unavailable on this device or for this userDo not auto retry. Check Play Store version and user account. Let the user try again manually. PBL 9 (with androidx.core 1.9+) also routes a system blocked Play Store here with a "Play Store is blocked" debugMessage, where PBL 8 returned ERROR.
ITEM_UNAVAILABLE4NoThe requested product is not available for purchaseRefresh product details with queryProductDetailsAsync(). The product may have been deactivated.
DEVELOPER_ERROR5NoInvalid arguments passed to the APIFix your code. Check product IDs, offer tokens, and parameter construction. This is a programming error.
ERROR6YesAn internal Google Play error occurredRetry with exponential backoff. If persistent, report to Google.
ITEM_ALREADY_OWNED7NoThe user already owns this item (a subscription, a non consumable, or a consumable that has not been consumed yet)Call queryPurchasesAsync() to refresh your local purchase cache. The user may have purchased on another device.
ITEM_NOT_OWNED8NoAttempted to consume or acknowledge an item the user does not ownCall queryPurchasesAsync() to refresh your local purchase cache. The purchase may have been refunded.
NETWORK_ERROR12YesA network error occurred during the operationRetry with a short delay (1-2 seconds). Check device connectivity.
SERVICE_DISCONNECTED-1YesThe BillingClient is not connected to the Play Store billing serviceWith enableAutoServiceReconnection() (opt in, PBL 8+) the library reconnects before the next call; if you still get this code, retry the call (simple retry in session, exponential backoff in the background). Without it, call startConnection() and retry.
FEATURE_NOT_SUPPORTED-2NoThe requested feature is not supported on this device or Play Store versionCheck isFeatureSupported() before calling feature specific APIs. Provide fallback behavior.
SERVICE_TIMEOUT-3Yes (Deprecated)The request timed outDeprecated in recent PBL versions. Treat as SERVICE_UNAVAILABLE and retry with backoff.

Sub Response Codes (PBL 8.0+)

Sub response codes provide more granular information about why a purchase failed. They are only available in the PurchasesUpdatedListener.onPurchasesUpdated() callback, retrieved via BillingResult.getOnPurchasesUpdatedSubResponseCode().

Sub Response CodeDescriptionWhen It AppearsRecommended Action
NO_APPLICABLE_SUB_RESPONSE_CODENo specific sub response appliesDefault value for most responsesHandle based on the main response code only.
PAYMENT_DECLINED_DUE_TO_INSUFFICIENT_FUNDSUser's available funds are less than the purchase priceWhen the main response indicates a payment failureShow a message suggesting the user check their payment method balance.
USER_INELIGIBLEUser does not meet eligibility requirements for an offerWhen the user attempts to use an offer they are not eligible forShow standard pricing without the offer. Check your offer eligibility logic.

Accessing sub response codes

kotlin
val listener = PurchasesUpdatedListener { billingResult, purchases ->
    if (billingResult.responseCode != BillingResponseCode.OK) {
        val subCode = billingResult.onPurchasesUpdatedSubResponseCode
        when (subCode) {
            OnPurchasesUpdatedSubResponseCode.PAYMENT_DECLINED_DUE_TO_INSUFFICIENT_FUNDS ->
                showInsufficientFundsMessage()
            OnPurchasesUpdatedSubResponseCode.USER_INELIGIBLE ->
                showStandardPricing()
            else -> handleGeneralError(billingResult)
        }
    }
}

Retry strategy summary

StrategyBase DelayFactorMax AttemptsUse For
Simple retry1-2 seconds1x (fixed)3NETWORK_ERROR
Exponential backoff2 seconds2x3SERVICE_UNAVAILABLE, ERROR, SERVICE_TIMEOUT
Reconnect, then retryLibrary (auto reconnection) or startConnection()Simple in session, backoff in background3SERVICE_DISCONNECTED
User initiatedN/AN/AN/ABILLING_UNAVAILABLE
No retryN/AN/AN/AUSER_CANCELED, DEVELOPER_ERROR, FEATURE_NOT_SUPPORTED

Phase 3: Handling Guidance

When you receive a BillingResult, walk it through this decision tree:

  1. Is responseCode equal to OK?

    • Yes: process the result. Done.
    • No: continue.
  2. Is responseCode equal to USER_CANCELED?

    • Yes: do nothing. The user chose to cancel. Done.
    • No: continue.
  3. Is the error retriable? (SERVICE_UNAVAILABLE, ERROR, NETWORK_ERROR, SERVICE_DISCONNECTED, SERVICE_TIMEOUT)

    • Yes: retry with the matching strategy from the retry summary table. Simple retry for NETWORK_ERROR, exponential backoff for service errors. If all retries fail, show an error message.
    • No: continue.
  4. Is it a cache sync issue? (ITEM_ALREADY_OWNED, ITEM_NOT_OWNED)

    • Yes: call queryPurchasesAsync() to refresh your purchase cache. Update UI accordingly.
    • No: continue.
  5. Is it a product issue? (ITEM_UNAVAILABLE)

    • Yes: refresh product details. The product may no longer be available.
    • No: continue.
  6. Is it a device or environment issue? (BILLING_UNAVAILABLE, FEATURE_NOT_SUPPORTED)

    • Yes: show a user facing message. Do not retry automatically. Let the user initiate a retry.
    • No: continue.
  7. Is it a developer error? (DEVELOPER_ERROR)

    • Yes: log the error with full details. Fix the API usage in your code. This should not happen in production.

Category quick reference

Group each code into one of six buckets so you can route it to the right handler:

  • Success: OK.
  • User intent: USER_CANCELED.
  • Transient service or network: SERVICE_UNAVAILABLE, ERROR, NETWORK_ERROR, SERVICE_DISCONNECTED, SERVICE_TIMEOUT.
  • Cache sync: ITEM_ALREADY_OWNED, ITEM_NOT_OWNED.
  • Catalog or product: ITEM_UNAVAILABLE.
  • Environment or configuration: BILLING_UNAVAILABLE, FEATURE_NOT_SUPPORTED.
  • Programming error: DEVELOPER_ERROR.

Checking a code with when

kotlin
fun classify(code: Int): Category = when (code) {
    BillingResponseCode.OK -> Category.SUCCESS
    BillingResponseCode.USER_CANCELED -> Category.USER_INTENT
    BillingResponseCode.SERVICE_UNAVAILABLE,
    BillingResponseCode.ERROR,
    BillingResponseCode.NETWORK_ERROR,
    BillingResponseCode.SERVICE_DISCONNECTED,
    BillingResponseCode.SERVICE_TIMEOUT -> Category.TRANSIENT
    BillingResponseCode.ITEM_ALREADY_OWNED,
    BillingResponseCode.ITEM_NOT_OWNED -> Category.CACHE_SYNC
    BillingResponseCode.ITEM_UNAVAILABLE -> Category.CATALOG
    BillingResponseCode.BILLING_UNAVAILABLE,
    BillingResponseCode.FEATURE_NOT_SUPPORTED -> Category.ENVIRONMENT
    BillingResponseCode.DEVELOPER_ERROR -> Category.PROGRAMMING
    else -> Category.UNKNOWN
}

References

よくある質問

AIスキル「Billing Response Codes」では何ができますか?

Use this skill as a reference lookup for every Play Billing Library BillingResponseCode and sub response code, with description, category, and handling guidance. Grounded in PBL 9.x.

TypingMindでBilling Response Codesを使うメリットは何ですか?

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

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

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

Billing Response Codesを使えるAIモデルはどれですか?

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

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

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

AIスキル「Billing Response Codes」は無料ですか?

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

AIスキルとは何ですか?

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

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

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

すべて見る

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

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