error-handling

error-handling is a skill for Claude Code, Codex from RevenueCat/play-billing-skills. It costs 52 tokens per session (2,475 once invoked), scanned A, original, Apache-2.0.

A guide to handling failures and retries in Google Play Billing Library. It groups billing errors by whether they can recover, cannot recover, or require the user to act.

In plain words
What is it for?
Reading BillingResult values, handling sub-response codes, designing retry delays, and adding safeguards such as a circuit breaker around billing calls.
Why use it?
Network loss, restarted Google services, cancelled purchases, and declined payments need different responses. This guide helps retry suitable failures with backoff while avoiding repeated requests that cannot succeed.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Reading BillingResult values, handling sub-response codes, designing retry delays, and adding safeguards such as a circuit breaker around billing calls.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/revenuecat/play-billing-skills/error-handling
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add RevenueCat/play-billing-skills --skill error-handling
Clone the repo
git clone --depth 1 https://github.com/RevenueCat/play-billing-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for error-handling

README.md
[![agentmods](https://agentmods.dev/badge/skills/revenuecat/play-billing-skills/error-handling/github.svg)](https://agentmods.dev/skills/revenuecat/play-billing-skills/error-handling)
Your own site
<a href="https://agentmods.dev/skills/revenuecat/play-billing-skills/error-handling"><img src="https://agentmods.dev/badge/skills/revenuecat/play-billing-skills/error-handling/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for error-handling

Your own site · 80×15
<a href="https://agentmods.dev/skills/revenuecat/play-billing-skills/error-handling"><img src="https://agentmods.dev/badge/skills/revenuecat/play-billing-skills/error-handling.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,475 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00052 $0.02475
Opus 5.5 $0.00021 $0.00990
Sonnet 5.5 $0.00010 $0.00495
Haiku 4.5 $0.00005 $0.00248

Measured 11d ago against content hash 804bc9f79c4b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

error-handling scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

google-play/error-handling/SKILL.md · 227 lines

How it starts

The opening of the file, as written. The whole thing — 227 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Error Handling and Retry Strategies

Every Play Billing Library call can fail. Network connections drop, the Play Store app updates or restarts, users cancel purchases, and payment methods get declined. This skill gives you a phased path from reading a BillingResult to shipping a retry layer that recovers gracefully without hammering Google's servers.

Phase 1: Read BillingResult correctly

Every PBL operation returns a BillingResult with two fields. Treat them asymmetrically.

  • responseCode is the integer constant you branch on. Always use the constants from BillingClient.BillingResponseCode, never the raw integer.
  • debugMessage is a log only string. Google can change the text at any time, so never parse it and never show it to users.
// PBL 9.x
val billingResult = billingClient.acknowledgePurchase(params)
when (billingResult.responseCode) {
    BillingClient.BillingResponseCode.OK -> { /* proceed */ }
    BillingClient.BillingResponseCode.NETWORK_ERROR -> { /* retry */ }
    else -> Log.e("Billing", billingResult.debugMessage)
}

PBL 8.0 added sub response codes, read in PurchasesUpdatedListener with BillingResult.getOnPurchasesUpdatedSubResponseCode() (Kotlin: billingResult.onPurchasesUpdatedSubResponseCode). Two are worth branching on:

  • PAYMENT_DECLINED_DUE_TO_INSUFFICIENT_FUNDS arrives under a top level ERROR and lets you suggest a different payment method instead of a generic failure screen.
  • USER_INELIGIBLE tells you the user does not qualify for the offer, so you can show alternatives they do qualify for.

Not every failure carries a sub response code. Check presence before acting.

Phase 2: Classify every response code

Before you write retry code, place every code in one of four buckets. Retriable codes drive loops. User driven codes drive UI prompts. Cache sync codes drive a refresh then replay. Terminal codes surface an error message and stop.

Response Code Value Category Action
OK 0 Success Proceed
USER_CANCELED 1 Ignore Return silently to previous screen
SERVICE_UNAVAILABLE 2 Retriable Exponential backoff
BILLING_UNAVAILABLE 3 User driven Show a generic unavailable message with a Try again button; never auto retry
ITEM_UNAVAILABLE 4 Cache sync Refresh product details
DEVELOPER_ERROR 5 Terminal Fix code, log debugMessage
ERROR 6 Retriable Exponential backoff
ITEM_ALREADY_OWNED 7 Cache sync Refresh purchases, grant access
ITEM_NOT_OWNED 8 Cache sync Refresh purchases
NETWORK_ERROR 12 Retriable Simple retry with short delay
SERVICE_DISCONNECTED -1 Reconnect With enableAutoServiceReconnection(): retry the call (simple in session, backoff in background). Without it: call startConnection, then retry
SERVICE_TIMEOUT -3 Retriable (deprecated, not returned since PBL 6) Treat as SERVICE_UNAVAILABLE
FEATURE_NOT_SUPPORTED -2 Terminal Hide feature in UI

Read the full file on GitHub · 227 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago Changed · +1 lines 804bc9f79c4b
  2. 1mo ago First seen · 226 lines · 52 tokens per session scan A a86a3a8e600c

Subscribe to this mod's changes

error-handling is a skill published in the GitHub repository RevenueCat/play-billing-skills (58 stars, last pushed 12d ago), licensed Apache-2.0. It adds 52 tokens to every session and 2,475 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

convex-billing

Add Stripe billing/payments to the Convex app via @convex-dev/stripe (checkout + webhook + gating).

openclaw/clawhub · 29 tokens

cloudbase-wechat-integration

A guide for connecting CloudBase applications to WeChat services, including payments, official accounts, and user identity.

TencentCloudBase/CloudBase-AI-Toolkit · 94 tokens

shopify-admin

Write or explain Admin GraphQL queries and mutations for apps and integrations that extend the Shopify admin. Use when the user wants to understand, design, or generate the operation itself—even before deciding how to run it. Do not choose admin first for app monetization—charging merchants for the app itself via app…

Shopify/Shopify-AI-Toolkit · 226 tokens

shopify-functions

Shopify Functions allow developers to customize the backend logic that powers parts of Shopify. Available APIs: Discount, Cart and Checkout Validation, Cart Transform, Pickup Point Delivery Option Generator, Delivery Customization, Fulfillment Constraints, Local Pickup Delivery Option Generator, Order Routing Location…

Shopify/Shopify-AI-Toolkit · 61 tokens

baselinker-webhooks

Receive BaseLinker (Base.com) webhooks. Use when building a BaseLinker order or warehouse callback receiver, because BaseLinker is not a normal webhook source: deliveries arrive as HTTP HEAD requests with NO body, the entire payload is in the query string (observed params: orderid, state), there is NO signature…

hookdeck/webhook-skills · 131 tokens

whatnot-webhooks

Receive and verify Whatnot webhooks (whatnot.com — the live-shopping and livestream-auction marketplace). Use when building a Whatnot Seller API app that handles webhook topics like order/created, order/updated, product/sold, listing/created, livestream/stopped or bulkoperation/finished, or when debugging…

hookdeck/webhook-skills · 136 tokens