Billing Response Codes logo

Billing Response Codes

Organization
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.

Overview

PublisherRevenueCat
Repositoryplay-billing-skills
Skill namebilling-response-codes
Stars
58
Forks
0
Bundled files
Instructions only
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by RevenueCat on GitHub. Read the source before you install it.

Installation

Install the Billing Response Codes AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/billing-response-codes
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Billing Response Codes in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Billing Response Codes on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Billing Response Codes is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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

Frequently asked questions

What does the Billing Response Codes AI skill do?

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.

Why use Billing Response Codes on TypingMind?

Because you install it once and use it with any model. Billing Response Codes is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Billing Response Codes in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/billing-response-codes. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Billing Response Codes?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Billing Response Codes?

As many as you like. As long as a model supports skills, you can use Billing Response Codes with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Billing Response Codes AI skill free?

Yes. It is published on GitHub by RevenueCat under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇