revenuecat/ai-toolkit/rc-error-handling
Claude Code and agent skill by revenuecat/ai-toolkit
- community
Checking that the SKILL.md file is still in the repository.
Use this skill when handling errors from the RevenueCat Android SDK. Covers PurchasesError, the PurchasesErrorCode enum, the userCancelled flag on PurchasesTransactionException, and the recommended UI response per code.
Install
npx vskill@latest install revenuecat/ai-toolkit/rc-error-handlingSKILL.md
The same SKILL.md was published earlier as revenuecat/ai-toolkit/rc-error-handling.
Error Handling
Phase 1: Understand
With raw Google Play Billing you enumerate every BillingResponseCode, split them into retriable and non retriable groups, and build backoff retry logic. RevenueCat collapses this into a single type you deal with: PurchasesError.
Key facts you rely on:
PurchasesErrorCodeis a cross platform enum with stable, readable codes.error.messageis a technical string. It belongs in logs, not in the UI.awaitPurchase()throwsPurchasesTransactionException, which adds auserCancelled: Booleanflag.- Every other
await*call (awaitOfferings,awaitGetProducts,awaitCustomerInfo,awaitRestore) throwsPurchasesException. - The SDK already retries transient billing and network failures internally. Any error that reaches you has exhausted the SDK retry budget. You do not add your own backoff loop. The only retry you implement is a user triggered "Try Again" button.
Phase 2: Plan
Before writing a catch block, decide three things:
- Which
await*call are you wrapping? That picks the exception type. - Which codes have specific handling? Everything else falls into a generic branch.
- What user facing string does each handled code map to?
Use this table to categorize PurchasesErrorCode values and pick the UX response.
| Code | Meaning | Handling | |
|---|---|---|---|
PurchaseCancelledError | User backed out of the flow | Do nothing. userCancelled is also true. | |
ProductAlreadyPurchasedError | Product already active for the user | Refresh CustomerInfo and check entitlements. | |
PaymentPendingError | Purchase entered pending state | Show a pending message. Wait for UpdatedCustomerInfoListener. | |
NetworkError | Request failed due to connectivity | Prompt the user to retry. | |
StoreProblemError | Google Play issue | Prompt to retry or update Play Store. | |
PurchaseNotAllowedError | Device or account cannot purchase. Since SDK 11.0.0 this includes a Play Store the system blocks (for example an OEM kids mode), which 10.x reported as StoreProblemError. | Show an explanatory message. Purchases.awaitCanMakePayments(context) returns false on such a device, so you can hide purchase entry points up front. | |
ProductNotAvailableForPurchaseError | Play reports the product unavailable for this user or region | Hide it and refetch offerings. |
IneligibleError is App Store only: it comes from a backend promotional offer code, not from Google Play. On Android, Play simply omits ineligible offers from subscriptionOptions.
Exception type decision:
| Call | Exception to catch | userCancelled available? | |
|---|---|---|---|
awaitPurchase() | PurchasesTransactionException | Yes | |
awaitRestore() | PurchasesException | No | |
awaitOfferings() | PurchasesException | No | |
awaitGetProducts() | PurchasesException | No | |
awaitCustomerInfo() | PurchasesException | No |
Phase 3: Execute
Purchase errors
Check userCancelled first and return silently. Then branch on error.code.
Non purchase errors
Catch PurchasesException and branch on the code. Use offline or cached fallbacks where you have them.
Map codes to user facing strings
Keep a single mapping function. Never pass e.error.message to the UI.
Checklist
- You picked
PurchasesTransactionExceptionforawaitPurchaseandPurchasesExceptionelsewhere. - You checked
userCancelledbefore any branching onerror.code. - You handled
PaymentPendingError,ProductAlreadyPurchasedError, andNetworkErrorwith their specific flows. - You logged
error.messageand showed a mapped string fromuserFacingMessageto the user. - You did not add retry loops around SDK calls. Retries are user initiated only.
References
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingrevenuecat-play-billing/skills/rc-error-handling/SKILL.md
Popularity
- Repository stars
- 73
- Repository forks
- 9
- 7-day trend score
- 27
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/revenuecat/ai-toolkit/rc-error-handling)