Logo van Billing Response Codes

Billing Response Codes

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

Overzicht

UitgeverRevenueCat
Repositoryplay-billing-skills
Skillnaambilling-response-codes
Sterren
58
Forks
0
Meegeleverde bestanden
Alleen instructies
LicentieApache-2.0
Links
  • Instructies in Markdown

    Het model laadt het bestand SKILL.md alleen als dat nodig is. Dat kost dus alleen tokens als een verzoek daadwerkelijk bij de skill past.

  • Werkt met elk LLM

    AI-skills bestaan uit instructies in gewone Markdown, niet uit aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • Compleet zonder extra bestanden

    Alles wat het model nodig heeft, staat in de instructies — geen extra bestanden om te synchroniseren.

  • Open source

    Gepubliceerd door RevenueCat op GitHub. Bekijk de bronbestanden voordat je de skill installeert.

Installatie

Installeer de AI-skill Billing Response Codes in TypingMind om deze met elk LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map. De app leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/billing-response-codes
  4. Schakel de skill in voor elke chat waarin je de skill wilt kunnen gebruiken.
Plug-ins → Skills → Skill toevoegen → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

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
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Billing Response Codes in voor een chat naar keuze in TypingMind en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek bij de skill past, laadt het model zelf de volledige instructies. Je hoeft de skill nooit handmatig aan te roepen. Pas als het model de skill daadwerkelijk gebruikt, kost dat tokens.

Het model laadt Billing Response Codes automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Billing Response Codes niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

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

Veelgestelde vragen

Wat doet de AI-skill 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.

Waarom Billing Response Codes gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Billing Response Codes bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model. Ook als je midden in een chat van model wisselt, blijft de skill werken. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek af te sluiten. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Billing Response Codes in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/billing-response-codes. TypingMind leest het bestand SKILL.md en installeert het als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Billing Response Codes gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Billing Response Codes gebruiken?

Zoveel als je wilt. Je kunt Billing Response Codes gebruiken met elk model dat skills ondersteunt, zoals GPT, Claude, Gemini, Grok, DeepSeek, Mistral of Llama. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Billing Response Codes gratis?

Ja. Deze skill is door RevenueCat op GitHub gepubliceerd onder de licentie Apache-2.0. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. De skill volgt het open Agent Skills-formaat: het bestand SKILL.md bevat de naam en beschrijving van de skill. Daarnaast kan de skill scripts, sjablonen of referentiebestanden bevatten die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Bekijk alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇