rc-purchase-flow
Use this skill when implementing a RevenueCat purchase on Android. Covers awaitPurchase, PurchasesTransactionException, reading CustomerInfo entitlements to grant access, restoring purchases, and the six SDK managed steps that happen inside a single call.
What this skill does
# Purchase Flow
A RevenueCat purchase on Android is two lines of code. The SDK handles the billing params, the Play sheet, the purchase token round trip, server side verification, and acknowledgment. You decide which package to pass in and what to do with the returned entitlements.
## Phase 1: Understand what awaitPurchase() does
One call to `Purchases.sharedInstance.awaitPurchase(params)` runs six steps under the hood. You do not write any of this.
| Step | What happens |
|------|--------------|
| 1 | Builds `BillingFlowParams` with the correct `ProductDetailsParams` from your `Package` |
| 2 | Calls `BillingClient.launchBillingFlow()` against the activity you passed |
| 3 | Suspends until the `PurchasesUpdatedListener` result arrives |
| 4 | If `OK`, posts the Play purchase token to the RevenueCat backend |
| 5 | Backend verifies via `purchases.subscriptionsv2.get` or `purchases.products.get` |
| 6 | SDK acknowledges (subs or non-consumables) or consumes (consumables) within the 3 day Google window |
The call returns `PurchaseResult(storeTransaction, customerInfo)`. Retriable failures are retried automatically.
See the [Purchase Flow chapter on revenuecat.com](https://www.revenuecat.com/guides/revenuecat-android-sdk/the-purchase-flow) for the six-step diagram and the full picture.
## Phase 2: Prepare the package
You need a `Package` from offerings before you can purchase. Fetch offerings, let your UI pick one, and hold the activity.
```kotlin
val offerings = Purchases.sharedInstance.awaitOfferings()
val pkg = offerings.current?.monthly ?: return
```
If you need a specific offer instead of the default, resolve a `SubscriptionOption` and pass that to `PurchaseParams.Builder` instead of the package.
```kotlin
val option = pkg.product.subscriptionOptions
?.firstOrNull { it.tags.contains("promo_50_off") }
?: pkg.product.defaultOption
?: return
```
For EU personalized pricing, chain `.isPersonalizedPrice(true)` on the builder so Play shows the customized price notice.
## Phase 3: Execute the purchase
Build the params, await the purchase, read `customerInfo` to gate access, and handle the two expected error branches.
```kotlin
try {
val result = Purchases.sharedInstance.awaitPurchase(
PurchaseParams.Builder(activity, pkg).build()
)
val customerInfo = result.customerInfo
if (customerInfo.entitlements["pro"]?.isActive == true) {
navigateToApp()
}
} catch (e: PurchasesTransactionException) {
when {
e.userCancelled -> { /* backed out, do nothing */ }
e.error.code == PurchasesErrorCode.ProductAlreadyPurchasedError ->
showMessage("You already have this subscription")
else -> showError(e.error.message)
}
}
```
Rules for this block:
- `PurchaseResult` is `@Poko`. Access fields as `result.customerInfo` and `result.storeTransaction`. Do not destructure with `val (transaction, customerInfo) = result`.
- `customerInfo.entitlements["<id>"]?.isActive == true` is the gate. Do not check `storeTransaction` to decide access.
- `PurchasesTransactionException` is the only exception type thrown by `awaitPurchase`. Catch it, branch on `userCancelled` first, then on `e.error.code`.
- User cancellation is not an error to surface. Swallow it.
If you prefer callbacks over coroutines, `purchaseWith(params, onError, onSuccess)` is the equivalent entry point.
## Phase 4: Inspect StoreTransaction only if you need it
`result.storeTransaction` is available but usually unused. `customerInfo` is the source of truth for entitlements. If you need transaction level data for logging or your own backend:
| Field | Type | Notes |
|-------|------|-------|
| `orderId` | `String?` | Null for restored purchases |
| `purchaseToken` | `String` | Raw Play purchase token |
| `productIds` | `List<String>` | Product IDs in the transaction |
| `purchaseTime` | `Long` | Epoch millis |
| `type` | `ProductType` | `SUBS` or `INAPP` |
## Phase 5: Restore on reinstall or device switch
Restore runs `queryPurchasesAsync()`, posts everything found to RevenueCat, and returns the fresh `CustomerInfo`. Gate access the same way you do after a purchase.
```kotlin
try {
val customerInfo = Purchases.sharedInstance.awaitRestore()
if (customerInfo.entitlements["pro"]?.isActive == true) {
navigateToApp()
} else {
showMessage("No active purchases found")
}
} catch (e: PurchasesException) {
showError(e.error.message)
}
```
Note the exception type. `awaitRestore()` throws `PurchasesException`, not `PurchasesTransactionException`. There is no `userCancelled` flag to check because no billing sheet is shown.
## Exception types at a glance
| Call | Thrown exception | Has `userCancelled`? |
|------|------------------|----------------------|
| `awaitPurchase(params)` | `PurchasesTransactionException` | Yes |
| `awaitRestore()` | `PurchasesException` | No |
## References
- [Full chapter](https://www.revenuecat.com/guides/revenuecat-android-sdk/the-purchase-flow)
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.