Skip to content
Skillv1.0.0

rc-payment-recovery

Use this skill when handling failed renewals on Android with RevenueCat. Covers how Grace Period and Account Hold are reflected in CustomerInfo automatically, when to prompt the user, and how to trigg

by revenuecat(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from revenuecat/ai-toolkit (revenuecat-play-billing/skills/rc-payment-recovery/SKILL.md) via skills.sh. Install upstream with npx skills add revenuecat/ai-toolkit --skill rc-payment-recovery. Copyright stays with the author (Apache-2.0; see LICENSE).

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.billingIssueDetectedAt is non null from the moment Google reports a billing problem until the user resolves it.
  • EntitlementInfo.isActive tells 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:

  1. Do you want the default Google in app message? If yes, do nothing. The SDK calls showInAppMessagesIfNeeded on BillingClient connect.
  2. Do you want your own banner or dialog? If yes, read billingIssueDetectedAt from CustomerInfo and branch on isActive.
  3. Do you want to gate the message to specific screens? If yes, disable the automatic call and invoke showInAppMessagesIfNeeded(activity) yourself.
  4. Do you need a server side flag (for example, to send a recovery email)? If yes, handle the BILLING_ISSUE webhook. 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.billingIssueDetectedAt becomes non null and isActive stays true.
  • Wait for account hold and confirm isActive flips to false while billingIssueDetectedAt remains non null.
  • Update the payment method and confirm billingIssueDetectedAt returns to null.
  • On backend, confirm a BILLING_ISSUE webhook fires on the first transition.

References

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/revenuecat-ai-toolkit-rc-payment-recovery/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

revenuecat-ai-toolkit-rc-payment-recovery.ocm.jsonjson
{
  "ocm": "1",
  "id": "revenuecat-ai-toolkit-rc-payment-recovery",
  "kind": "skill",
  "name": "rc-payment-recovery",
  "description": "Use this skill when handling failed renewals on Android with RevenueCat. Covers how Grace Period and Account Hold are reflected in CustomerInfo automatically, when to prompt the user, and how to trigger Google's in app messaging via showInAppMessages.",
  "publisher": "revenuecat",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "general"
    ],
    "tags": [
      "skill-md",
      "android",
      "revenuecat",
      "payment-recovery",
      "grace-period",
      "account-hold",
      "in-app-messaging",
      "skills-sh"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Use this skill when handling failed renewals on Android with RevenueCat. Covers how Grace Period and Account Hold are reflected in CustomerInfo automatically, when to prompt the user, and how to trigger Google's in app messaging via showInAppMessages."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "skills.sh",
      "repository": "https://github.com/revenuecat/ai-toolkit",
      "path": "revenuecat-play-billing/skills/rc-payment-recovery/SKILL.md",
      "ref": "HEAD",
      "url": "https://www.skills.sh/revenuecat/ai-toolkit/rc-payment-recovery",
      "key": "revenuecat/ai-toolkit/revenuecat-play-billing/skills/rc-payment-recovery/SKILL.md"
    },
    "license": "Apache-2.0; see LICENSE"
  },
  "instructions": "# Payment Recovery\n\nFailed 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.\n\n## Phase 1: Understand\n\nThree things happen when a renewal fails:\n\n| State | Access | How RevenueCat surfaces it | User sees |\n| --- | --- | --- | --- |\n| Grace period | Retained | `entitlement.isActive == true` and `billingIssueDetectedAt != null` | Google",
  "cost": {
    "context_tokens": 928
  }
}

Fetch it by URL: GET /api/v1/registry/revenuecat-ai-toolkit-rc-payment-recovery/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.