| name | revenuecat-api-quick-reference |
| description | Use this skill as a quick reference for the RevenueCat Android SDK 10.x and REST API. Covers SDK init, common Purchases calls, CustomerInfo / Offerings access patterns, and the most used REST endpoints. |
| license | Apache-2.0; see LICENSE |
| metadata | {"author":"RevenueCat","source":"revenuecat-handbook appendix A","keywords":["android","revenuecat","sdk-reference","rest-reference"]} |
RevenueCat API Quick Reference
Phase 0: Intent
Use this skill when you need a fast lookup of a RevenueCat API surface while writing Android code or server logic. Typical questions you answer from here:
- Which builder option controls a given
Purchases.configure behavior?
- What is the return type and signature of
awaitPurchase, awaitOfferings, awaitCustomerInfo, awaitRestore, awaitLogIn, awaitLogOut?
- How do I read offering, package, product, entitlement fields?
- Which
PurchasesErrorCode should I branch on?
- Which listener callback do I register for customer info updates?
Do not use this skill as a deep tutorial. Reach for the feature-specific skills (purchase flow, configuring the SDK, error handling, subscription states) when you need step-by-step guidance or design rationale.
Phase 1: Locate
Decide SDK surface vs REST surface before you search the tables.
Route to the SDK (client side, Android app code):
- Code runs inside the Android app, in an
Activity, ViewModel, or background worker bundled with your app.
- You need to launch a purchase, restore purchases, read cached
CustomerInfo, fetch Offerings, identify or log out a user, or listen for updates.
- You want entitlement gating in the UI.
Route to the REST API (server side):
- Code runs on your backend, in a webhook handler, in an admin tool, or in a scheduled job.
- You need to grant or revoke a promotional entitlement, override a subscription, look up a subscriber from another service, refund, or deliver events to another system.
- You are integrating with a system that cannot embed the SDK.
The tables in this skill cover the Android SDK 10.x surface from appendix A verbatim. For REST endpoint paths, authentication, and payloads, see the full appendix on revenuecat.com together with the backend and webhooks skills, and treat this file as the SDK index.
Phase 2: Reference Tables
SDK Initialization
Purchases.configure(
PurchasesConfiguration.Builder(context, "api_key").build()
)
Purchases.configure(
PurchasesConfiguration.Builder(context, "api_key")
.appUserID("user_id")
.showInAppMessagesAutomatically(true)
.purchasesAreCompletedBy(PurchasesAreCompletedBy.REVENUECAT)
.entitlementVerificationMode(EntitlementVerificationMode.INFORMATIONAL)
.diagnosticsEnabled(false)
.pendingTransactionsForPrepaidPlansEnabled(false)
.build()
)
Purchases.logLevel = LogLevel.DEBUG
Core Operations (Coroutine)
val offerings: Offerings = Purchases.sharedInstance.awaitOfferings()
val products: List<StoreProduct> = Purchases.sharedInstance.awaitGetProducts(
listOf("product_id"),
type = ProductType.INAPP
)
val result: PurchaseResult = Purchases.sharedInstance.awaitPurchase(
PurchaseParams.Builder(activity, packageOrStoreProductOrSubscriptionOption).build()
)
val result = Purchases.sharedInstance.awaitPurchase(
PurchaseParams.Builder(activity, newPackage)
.oldProductId("old_product_id")
.googleReplacementMode(GoogleReplacementMode.WITH_TIME_PRORATION)
.build()
)
val customerInfo: CustomerInfo = Purchases.sharedInstance.awaitCustomerInfo()
val fresh: CustomerInfo = Purchases.sharedInstance.awaitCustomerInfo(
fetchPolicy = CacheFetchPolicy.FETCH_CURRENT
)
val customerInfo: CustomerInfo = Purchases.sharedInstance.awaitRestore()
val loginResult: LogInResult = Purchases.sharedInstance.awaitLogIn("user_id")
val customerInfo: CustomerInfo = Purchases.sharedInstance.awaitLogOut()
Offerings Structure
val offerings: Offerings
offerings.current
offerings.all
offerings["my_offering"]
offerings.getCurrentOfferingForPlacement("placement_id")
val offering: Offering
offering.identifier
offering.monthly
offering.annual
offering.weekly
offering.availablePackages
offering.metadata
val pkg: Package
pkg.identifier
pkg.packageType
pkg.product
pkg.webCheckoutURL
val product: StoreProduct
product.productId
product.title
product.description
product.price.formatted
product.price.amountMicros
product.price.currencyCode
product.period
product.subscriptionOptions
product.defaultOption
Entitlements
val customerInfo: CustomerInfo
customerInfo.entitlements.active
customerInfo.entitlements.all
customerInfo.entitlements["pro_access"]
customerInfo.activeSubscriptions
customerInfo.nonSubscriptionTransactions
customerInfo.managementURL
val entitlement: EntitlementInfo
entitlement.isActive
entitlement.willRenew
entitlement.expirationDate
entitlement.periodType
entitlement.billingIssueDetectedAt
entitlement.unsubscribeDetectedAt
entitlement.store
entitlement.productIdentifier
entitlement.productPlanIdentifier
entitlement.verification
Error Handling
try {
Purchases.sharedInstance.awaitPurchase(params)
} catch (e: PurchasesTransactionException) {
e.userCancelled
e.error.code
e.error.message
}
try {
Purchases.sharedInstance.awaitOfferings()
} catch (e: PurchasesException) {
e.error.code
}
PurchasesErrorCode.PurchaseCancelledError
PurchasesErrorCode.ProductAlreadyPurchasedError
PurchasesErrorCode.PaymentPendingError
PurchasesErrorCode.NetworkError
PurchasesErrorCode.StoreProblemError
PurchasesErrorCode.IneligibleError
PurchasesErrorCode.ConfigurationError
Listeners
Purchases.sharedInstance.updatedCustomerInfoListener =
UpdatedCustomerInfoListener { customerInfo -> }
Purchases.sharedInstance.showInAppMessagesIfNeeded(activity)
Phase 3: Typical Snippets
Gate a feature on an entitlement.
val info = Purchases.sharedInstance.awaitCustomerInfo()
val hasPro = info.entitlements["pro_access"]?.isActive == true
if (hasPro) unlockFeature() else showPaywall()
Buy the monthly package from the current offering.
val current = Purchases.sharedInstance.awaitOfferings().current ?: return
val monthly = current.monthly ?: return
val result = Purchases.sharedInstance.awaitPurchase(
PurchaseParams.Builder(activity, monthly).build()
)
Handle cancel vs real failure.
try {
Purchases.sharedInstance.awaitPurchase(params)
} catch (e: PurchasesTransactionException) {
if (e.userCancelled) return
when (e.error.code) {
PurchasesErrorCode.PaymentPendingError -> showPendingUi()
PurchasesErrorCode.NetworkError -> showRetry()
else -> showGenericError(e.error.message)
}
}
Force a fresh CustomerInfo fetch after a server side grant.
val fresh = Purchases.sharedInstance.awaitCustomerInfo(
fetchPolicy = CacheFetchPolicy.FETCH_CURRENT
)
Log in an identified user and detect first login.
val login = Purchases.sharedInstance.awaitLogIn("user_123")
val isNewAlias = login.created
val info = login.customerInfo
React to background entitlement changes.
Purchases.sharedInstance.updatedCustomerInfoListener =
UpdatedCustomerInfoListener { info ->
val active = info.entitlements["pro_access"]?.isActive == true
uiState.update { it.copy(hasPro = active) }
}
References