Install
$ agentstack add skill-revenuecat-play-billing-skills-payment-recovery ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Payment Recovery
Failed renewals on Google Play move a subscription through two states: grace period (user keeps access while Google retries the card) and account hold (access revoked until the user fixes the payment method). With RevenueCat, both states land in CustomerInfo automatically, and Google's in app message shows by default.
Phase 1: Understand
Three things happen when a renewal fails:
| State | Access | How RevenueCat surfaces it | User sees | | --- | --- | --- | --- | | Grace period | Retained | entitlement.isActive == true and billingIssueDetectedAt != null | Google in app snackbar by default | | Account hold | Revoked | entitlement.isActive == false and billingIssueDetectedAt != null | Google in app snackbar by default | | Recovered | Retained | billingIssueDetectedAt == null | Nothing |
Two signals matter in the SDK:
EntitlementInfo.billingIssueDetectedAtis non null from the moment Google reports a billing problem until the user resolves it.EntitlementInfo.isActivetells you whether they still have access.
On the backend, a BILLING_ISSUE webhook fires once per transition. You do not decode RTDNs.
Phase 2: Plan
Before you write app code, decide what you actually need. Most apps need none.
Ask:
- Do you want the default Google in app message? If yes, do nothing. The SDK calls
showInAppMessagesIfNeededon BillingClient connect. - Do you want your own banner or dialog? If yes, read
billingIssueDetectedAtfromCustomerInfoand branch onisActive. - Do you want to gate the message to specific screens? If yes, disable the automatic call and invoke
showInAppMessagesIfNeeded(activity)yourself. - Do you need a server side flag (for example, to send a recovery email)? If yes, handle the
BILLING_ISSUEwebhook. No app code required.
If you only want the default behavior, stop here.
Phase 3: Execute
Default (recommended)
Leave automatic in app messages on. This is the default:
PurchasesConfiguration.Builder(context, apiKey)
.showInAppMessagesAutomatically(true)
.build()
Manual trigger
Disable the automatic call and show the message from your chosen activity:
PurchasesConfiguration.Builder(context, apiKey)
.showInAppMessagesAutomatically(false)
.build()
Purchases.sharedInstance.showInAppMessagesIfNeeded(activity)
Your own UI during grace period
Read the entitlement and branch on both flags:
val entitlement = customerInfo.entitlements["pro_access"]
when {
entitlement == null || !entitlement.isActive ->
showSubscribeScreen()
entitlement.billingIssueDetectedAt != null && entitlement.isActive ->
showGracePeriodWarning()
entitlement.billingIssueDetectedAt != null && !entitlement.isActive ->
showAccountHoldScreen()
else ->
showPremiumContent()
}
Send the user to fix payment
CustomerInfo.managementURL points to the Google Play subscription page:
customerInfo.managementURL?.let { url ->
startActivity(Intent(Intent.ACTION_VIEW, url))
}
Phase 4: Verify
Test each transition:
- Use a Google Play test card that declines renewals to push a subscription into grace period.
- Confirm
entitlement.billingIssueDetectedAtbecomes non null andisActivestaystrue. - Wait for account hold and confirm
isActiveflips tofalsewhilebillingIssueDetectedAtremains non null. - Update the payment method and confirm
billingIssueDetectedAtreturns tonull. - On backend, confirm a
BILLING_ISSUEwebhook fires on the first transition.
References
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: RevenueCat
- Source: RevenueCat/play-billing-skills
- License: Apache-2.0
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.