/revenuecat-play-billing:rc-subscription-statesfrom revenuecat-play-billing
Gates Android app access using RevenueCat subscription state. Covers reading CustomerInfo, checking entitlement.isActive, and drilling into willRenew, periodType, and expirationDate for deeper logic.
Ships in revenuecat-play-billing. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Decide whether a user has access, and drive state aware UI, using CustomerInfo and EntitlementInfo on Android.
Confirm what you are actually checking before you write code.
pro_access)If you only need access on/off, you only need isActive. Everything else is optional context.
Rolling your own tracker with the Google Play Developer API means mapping eight subscription states and deciding which grant access.
| Google state | Grants access? |
|---|---|
| ACTIVE | yes |
| IN_GRACE_PERIOD | yes |
CANCELED (before expirationDate) | yes |
| ON_HOLD | no |
| PAUSED | no |
| EXPIRED | no |
| PENDING | no |
| PENDING_PURCHASE_CANCELED | no |
RevenueCat computes this on the backend from the Google SubscriptionPurchaseV2 resource and exposes the result as one field: EntitlementInfo.isActive. You read a boolean instead of implementing the state machine.
| Need | Field |
|---|---|
| Does the user have access right now? | entitlement.isActive |
| Will the subscription renew at period end? | entitlement.willRenew |
| When does paid access end? | entitlement.expirationDate |
| Is this a trial, intro, prepaid, or normal period? | entitlement.periodType |
| Is there a payment problem? | entitlement.billingIssueDetectedAt |
| Has the user canceled but still has time left? | entitlement.unsubscribeDetectedAt |
| Which store issued the entitlement? | entitlement.store |
isActive == true. Nothing else.billingIssueDetectedAt != null to show a fix payment prompt.unsubscribeDetectedAt != null with expirationDate to show a renewal reminder while access is still valid.!willRenew (when no billing issue and no explicit cancel timestamp) to show a non renewing notice.val customerInfo = Purchases.sharedInstance.awaitCustomerInfo()
val hasAccess = customerInfo.entitlements["pro_access"]?.isActive == true
awaitCustomerInfo() returns the disk cache immediately, then refreshes from the network in the background. Entitlement checks stay fast, even offline.
Use this after a server side grant (for example, a support agent issued a promo).
val fresh = Purchases.sharedInstance.awaitCustomerInfo(
fetchPolicy = CacheFetchPolicy.FETCH_CURRENT
)
isActive gates access; the other fields explain context.
fun updateUI(entitlement: EntitlementInfo?) {
if (entitlement != null && !entitlement.isActive && entitlement.billingIssueDetectedAt != null) {
// Account hold, or an expiry after a billing issue that was never resolved. See rc-payment-recovery.
showAccountHoldScreen(); return
}
if (entitlement == null || !entitlement.isActive) {
showSubscribeScreen(); return
}
showPremiumContent()
when {
entitlement.billingIssueDetectedAt != null -> showBillingIssueWarning()
entitlement.unsubscribeDetectedAt != null ->
entitlement.expirationDate?.let { showExpiryNotice(it) }
!entitlement.willRenew -> showNonRenewingNotice()
}
}
| Signal on an active entitlement | Message to show |
|---|---|
billingIssueDetectedAt != null | Payment problem, update method |
unsubscribeDetectedAt != null | Access ends on expirationDate |
willRenew == false (no other signal) | Will not renew this period |
periodType == TRIAL or INTRO | Trial or intro pricing in effect |
val result = Purchases.sharedInstance.awaitLogIn("your_user_id")
val customerInfo = result.customerInfo
val createdNewUser = result.created
awaitLogIn() merges anonymous purchases with the identified user. logOut() starts a fresh anonymous session.
Register a listener so UI reacts to purchases, restores, and background refreshes without manual polling.
Purchases.sharedInstance.updatedCustomerInfoListener =
UpdatedCustomerInfoListener { info ->
val active = info.entitlements["pro_access"]?.isActive == true
updateAccessGate(active)
}
Setting the listener immediately delivers the cached CustomerInfo if one exists. On a first launch with no cache it fires only after the first fetch, so still call awaitCustomerInfo() on launch to drive the initial UI.
Walk through each case and confirm the UI responds correctly.
| Case | Expected isActive | Expected UI |
|---|---|---|
| Fresh purchase | true | Premium content |
| Grace period (billing issue, still granted) | true | Premium + billing warning |
Canceled, still before expirationDate | true | Premium + expiry notice |
| On hold | false | Account hold screen (fix payment method, paywall as a fallback) |
| Expired after a billing issue that was never resolved | false | Account hold screen, whose paywall path lets the user buy again |
| Paused | false | Subscribe screen |
| Expired | false | Subscribe screen |
| Pending (no payment yet) | false | Subscribe screen |
FETCH_CURRENT updates CustomerInfo after a backend grant (promo, refund, support action).logOut(), CustomerInfo reflects an anonymous user and isActive resets accordingly.CustomerInfo and gates access without a network call.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub revenuecat/ai-toolkit --plugin revenuecat-play-billing20 skills in this plugin
/rc-alternative-billingUse this skill when scoping Google Play alternative billing work with RevenueCat Android SDK 11.x. Documents the support status as of purchases-android 11.1.0, which flows RevenueCat abstracts, and which require direct integration./rc-backendUse this skill when your backend needs to read or update RevenueCat state on Android. Covers the RevenueCat REST API (v1 subscribers endpoint, grant/revoke entitlements, attributes), secret vs public SDK API key usage, and why you do not build a receipt verification backend with RevenueCat./rc-cancellations-pauses-winbackUse this skill when surfacing cancellation, pause, and winback state on Android with RevenueCat. Covers reading unsubscribeDetectedAt, billingIssueDetectedAt, pause state and resume date via SubscriptionInfo.autoResumeDate, showManageSubscriptions for the deep link, and the SUBSCRIPTION_PAUSED webhook./rc-catalog-managementUse this skill when managing the Android product catalog through the Play Console and the RevenueCat dashboard. Covers the two sided catalog flow (create in Play Console, import or map in RevenueCat), entitlement and offering maintenance, and why you do not call the Google Play Developer API directly./rc-configuring-the-sdkUse this skill when adding and configuring the RevenueCat Android SDK (purchases-android, artifact com.revenuecat.purchases:purchases) in an app. Covers the Gradle dependency, Purchases.configure with PurchasesConfiguration, initial app user id strategy, and log level./rc-error-handlingUse 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.Other plugins' skills for the same job