Loading...
Loading...
Use this skill when selling one time products on Android with RevenueCat. Covers fetching offerings, running awaitPurchase on a non subscription package, and relying on the SDK to acknowledge or consume automatically.
npx skill4agent add revenuecat/ai-toolkit rc-one-time-products| Question | Decision |
|---|---|
| Is the product consumable or non consumable? | Mark consumables in the RevenueCat dashboard so the SDK calls |
| Do you read access through entitlements or transactions? | Prefer entitlements so access logic stays decoupled from product IDs. |
| Do you need server notification of the purchase? | Use RevenueCat webhooks. The |
BillingClient.queryProductDetailsAsyncacknowledgePurchaseconsumeAsyncBillingClientPurchases.configureCustomerInfoval offerings = Purchases.sharedInstance.awaitOfferings()
val pkg = offerings.current?.availablePackages?.first() ?: returnawaitPurchaseval result = Purchases.sharedInstance.awaitPurchase(
PurchaseParams.Builder(activity, pkg).build()
)
val info = result.customerInfoval hasAccess = info.entitlements["lifetime_access"]?.isActive == true
val owned = info.nonSubscriptionTransactions
.any { it.productIdentifier == "lifetime_product_id" }acknowledgePurchaseconsumeAsyncawaitPurchasetry { /* awaitPurchase */ } catch (e: PurchasesTransactionException) {
when {
e.error.code == PurchasesErrorCode.PaymentPendingError -> showPending()
e.userCancelled -> Unit
else -> showError(e.error.message)
}
}| Outcome | SDK signal | Action |
|---|---|---|
| Success | | Grant access from |
| User cancel | | Swallow silently. |
| Pending payment | | Show a pending message. The SDK updates the entitlement later through |
| Other error | | Surface |
result.customerInfoawaitPurchaseUpdatedCustomerInfoListenerINITIAL_PURCHASE