Logo : Payment Recovery

Payment Recovery

Organisation
RevenueCat
payment-recovery

Use this skill when handling failed subscription renewals on Google Play. Covers Grace Period (user keeps access), Account Hold (access revoked), the RTDN signals that move between stages, and the in app messaging required to drive recovery.

Add to TypingMind

Présentation

ÉditeurRevenueCat
Dépôtplay-billing-skills
Nom de la compétencepayment-recovery
Étoiles
58
Forks
0
Fichiers inclus
Instructions uniquement
LicenceApache-2.0
Liens
  • Instructions en Markdown

    Un fichier SKILL.md que le modèle charge à la demande : il ne consomme donc des tokens que lorsqu’une demande correspond réellement à la compétence.

  • Compatible avec tous les LLM

    Les compétences IA sont rédigées en Markdown et non sous forme de code propre à un fournisseur. Elles fonctionnent donc avec GPT, Claude, Gemini, Grok ou un modèle local.

  • Tout dans les instructions

    Tout ce dont le modèle a besoin se trouve dans les instructions : aucun fichier supplémentaire à synchroniser.

  • Open source

    Publiée par RevenueCat sur GitHub. Consultez les sources avant de l’installer.

Installation

Installez la compétence IA Payment Recovery dans TypingMind pour l’utiliser avec n’importe quel LLM, ou ajoutez-la à un autre agent capable de lire SKILL.md.

1

Installer dans TypingMind

TypingMind installe une compétence directement depuis son dossier GitHub : l’application lit SKILL.md, regroupe les fichiers de ressources et enregistre le tout localement.

  1. Ouvrez l’application et accédez à Plugins → Compétences.
  2. Choisissez « Installer depuis GitHub ».
  3. Copiez l’URL ci-dessous, qui pointe vers le dossier de la compétence, puis collez-la et confirmez.
    https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/payment-recovery
  4. Activez la compétence dans chaque discussion où vous souhaitez pouvoir l’utiliser.
Plugins → Compétences → Ajouter une compétence → Via une URL GitHub, puis collez l’URL du dossier et appuyez sur Continuer.
2

Installer dans un autre agent

Tout agent capable de lire le format Agent Skills peut utiliser cette compétence : copiez le dossier dans le répertoire des compétences de cet agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/RevenueCat/play-billing-skills.git /tmp/play-billing-skills
mkdir -p .claude/skills
cp -r /tmp/play-billing-skills/google-play/payment-recovery .claude/skills/payment-recovery
Redémarrez Claude Code après la copie pour que la nouvelle compétence soit prise en compte.

Utilisez cette compétence dans TypingMind

Activez Payment Recovery dans n’importe quelle discussion TypingMind et le modèle s’occupe du reste. Le nom et la description de la compétence figurent dans le prompt système. Dès qu’une demande correspond, le modèle charge lui-même l’intégralité des instructions : vous n’avez jamais à l’invoquer manuellement, et elle ne consomme aucun token tant qu’elle n’est pas utilisée.

Le modèle charge automatiquement Payment Recovery dès qu’une demande correspond à cette compétence.

Compatible avec tous les modèles IA

Les compétences IA sont de simples instructions Markdown, et non du code propre à un fournisseur. Ainsi, la compétence Payment Recovery n’est pas liée au modèle pour lequel elle a été conçue. Installez-la une seule fois dans TypingMind et utilisez-la avec GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou un modèle local que vous exécutez vous-même, le tout avec vos propres clés API.

  • Chargée uniquement en cas de besoin

    Le prompt système ne contient que le nom et la description. Les instructions sont récupérées à la première demande correspondante : une compétence inutilisée ne coûte donc rien.

  • Changez de modèle en cours de discussion

    La compétence étant constituée d’instructions et non de code, elle reste fonctionnelle lorsque vous changez de modèle : le nouveau modèle lit le même fichier SKILL.md.

Instructions de la compétence

Voici le contenu de SKILL.md que le modèle charge. Lisez-le avant l’installation : une compétence contient des instructions que votre modèle suivra.

Payment Recovery: Grace Period and Account Hold

Google Play does not cancel a subscription the moment a renewal charge fails. It runs a two stage recovery process: grace period (user keeps access while Google retries) then account hold (access revoked while Google keeps retrying). Your job is to react to the right RTDNs, toggle entitlements at the right moments, and prompt the user to fix payment without forcing them to leave your app.

Phase 1: Understand

Map the stages, the RTDN for each transition, and the entitlement you should hold.

StageEntry RTDNDurationUser accessSubscriptionPurchaseV2 state
Silent grace periodnone (always applies)~1 dayActiveSUBSCRIPTION_STATE_ACTIVE
Configured grace periodSUBSCRIPTION_IN_GRACE_PERIOD0 to 30 days (per base plan)Keep full accessSUBSCRIPTION_STATE_IN_GRACE_PERIOD
Account holdSUBSCRIPTION_ON_HOLD0 to 60 days (default 60 minus grace; grace + hold total 30 to 60)RevokeSUBSCRIPTION_STATE_ON_HOLD
Recovered from graceSUBSCRIPTION_RENEWEDn/aKeep, clear warningSUBSCRIPTION_STATE_ACTIVE (renewal date unchanged)
Recovered from holdSUBSCRIPTION_RECOVEREDn/aRestore immediatelySUBSCRIPTION_STATE_ACTIVE (billing date moves to recovery date)
Terminal failureSUBSCRIPTION_CANCELED (3), then SUBSCRIPTION_EXPIRED (13)n/aGonecanceled/expired

Key facts to internalize before writing any code:

  • The silent grace period of about 1 day always applies, even with a 0 day configuration. It is folded into any longer grace period you set (a 7 day window means 7 total days, not 7 + 1).
  • Client side Purchase objects look identical in grace period and in a healthy renewal: isAutoRenewing = true, purchaseState == PURCHASED. You cannot detect grace period from queryPurchasesAsync(). Source of truth is the server side RTDN plus SubscriptionPurchaseV2.subscriptionState.
  • Grace period expiryTime points to the end of the grace window, not the original renewal date.
  • On recovery from account hold, Google moves the billing date to the recovery date; recovery during grace period keeps the original renewal date. Persist the new expiryTime from SubscriptionPurchaseV2 either way; cached pre failure dates will be wrong.
  • If you disable account hold, the subscription cancels immediately after grace period ends. Google's default enables both, with account hold = 60 days minus the grace period.

Phase 2: Plan the dunning policy

Decide these rules before you touch code. The rest of the skill is mechanical once this is set.

Stage to action mapping

StageEntitlementPrimary UISecondary channelsUrgency
Silent grace periodKeepnone (you do not see the RTDN)nonen/a
Grace periodKeepDismissible banner on main screenPush on day 0, email by day 3, optional showInAppMessages(TRANSACTIONAL) at natural launch pointsSoft, informational
Account holdRevokeFull screen account hold screen with single CTAPush on transition, email midway through holdHigh, blocking
RecoveredRestoreOptional toast or inline confirmationOptional confirmation emailn/a
Canceled after holdGoneResubscribe screenFinal email with resubscribe linkn/a

Messaging cadence during recovery

  • Day 0 of grace period: push notification immediately on SUBSCRIPTION_IN_GRACE_PERIOD plus banner in app.
  • Day 3 of grace period: email reminder with deep link to payment update.
  • Transition to account hold: push notification plus switch app UI to full screen hold screen. Revoke entitlement in the same transaction that flips the flag.
  • Midway through account hold: second email. Increase urgency wording.
  • On SUBSCRIPTION_RENEWED (grace) or SUBSCRIPTION_RECOVERED (hold): clear the relevant flag, restore entitlement if it was revoked, persist the new expiryTime, optional confirmation message.

Rules you should codify

  1. Never revoke during grace period. That is Google's guideline and the main retention lever.
  2. Always revoke on SUBSCRIPTION_ON_HOLD. Do not wait for the user to open the app.
  3. Treat the server flag, not Purchase.isAutoRenewing, as the source of truth for recovery state.
  4. On SUBSCRIPTION_RENEWED (grace) or SUBSCRIPTION_RECOVERED (hold), overwrite the cached renewal date with the new expiryTime.
  5. When changing grace or account hold durations, extend rather than shorten. Shortening does not affect subscribers already in grace, but it lowers recovery for every later payment failure. If you must shorten, monitor SUBSCRIPTION_ON_HOLD and SUBSCRIPTION_CANCELED volume after the change.

Phase 3: Execute

3.1 Backend: handle the four transition RTDNs

For each RTDN, look up the purchase token, fetch SubscriptionPurchaseV2 from the Google Play Developer API, confirm the state, then flip flags.

SUBSCRIPTION_IN_GRACE_PERIOD:

  1. Confirm subscriptionState == SUBSCRIPTION_STATE_IN_GRACE_PERIOD.
  2. Set gracePeriod = true on the user record. Keep entitlement active.
  3. Trigger push notification and queue the day 3 email.

SUBSCRIPTION_ON_HOLD:

  1. Confirm subscriptionState == SUBSCRIPTION_STATE_ON_HOLD.
  2. Set onHold = true. Revoke the entitlement now.
  3. Trigger push notification. Queue the midway hold email.

SUBSCRIPTION_RENEWED while gracePeriod == true (recovery during grace period; renewal date unchanged):

  1. Confirm subscriptionState == SUBSCRIPTION_STATE_ACTIVE.
  2. Clear gracePeriod on the user record. Entitlement was never revoked.
  3. Persist the new expiryTime. Optional confirmation message.

SUBSCRIPTION_RECOVERED (recovery from account hold, or resume from pause):

kotlin
// Server side handler
fun handleSubscriptionRecovered(token: String, pkg: String) {
    val sub = playApi.getSubscriptionV2(pkg, token)
    if (sub.subscriptionState != "SUBSCRIPTION_STATE_ACTIVE") return
    val rec = db.findByPurchaseToken(token) ?: return
    rec.status = "ACTIVE"
    rec.gracePeriod = false
    rec.onHold = false
    rec.renewalDate = sub.lineItems.firstOrNull()?.expiryTime
    db.update(rec)
}

After account hold expires without recovery, you get SUBSCRIPTION_CANCELED (3), then SUBSCRIPTION_EXPIRED (13). Treat it like any cancellation: revoke, update, optional resubscribe email.

3.2 Client: drive UI from server flags

Let a single function branch on the server reported status. Do not try to derive this from queryPurchasesAsync(): by default it omits subscriptions in account hold. On PBL 8.1+ you can query with QueryPurchasesParams.newBuilder().setProductType(ProductType.SUBS).includeSuspendedSubscriptions(true).build(); a purchase with isSuspended == true is on hold or paused, so do not grant access and deep link to the subscriptions center instead.

kotlin
// PBL 9.x
fun handleSubscriptionState(status: SubscriptionStatus) {
    when {
        status.isOnHold -> {
            revokeEntitlement()
            showAccountHoldScreen()
        }
        status.isInGracePeriod -> {
            // keep access, show dismissible banner
            showGracePeriodBanner()
        }
        status.isActive -> grantEntitlement()
    }
}

3.3 Client: showInAppMessages() for payment issues

Call at natural moments (app launch, entering a subscription gated feature, or when server flags indicate grace or hold). The TRANSACTIONAL category covers both grace period and account hold. If there is nothing to show, the call returns NO_ACTION_NEEDED.

kotlin
// PBL 9.x
fun showPaymentRecovery(activity: Activity) {
    val params = InAppMessageParams.newBuilder()
        .addInAppMessageCategoryToShow(
            InAppMessageParams
                .InAppMessageCategoryId.TRANSACTIONAL
        ).build()
    billingClient.showInAppMessages(activity, params) { r ->
        if (r.responseCode ==
            InAppMessageResult.InAppMessageResponseCode
                .SUBSCRIPTION_STATUS_UPDATED
        ) refreshSubscriptionStatus()
    }
}

On SUBSCRIPTION_STATUS_UPDATED, re sync with your backend. Google has confirmed the payment was fixed inside the dialog, but your server flag is still stale until the SUBSCRIPTION_RENEWED (grace) or SUBSCRIPTION_RECOVERED (hold) RTDN lands; send r.purchaseToken to your backend to re fetch now.

3.4 Deep link to Play Store subscription management

Use this as the CTA target from banners, the hold screen, and notifications.

kotlin
// PBL 9.x
fun openSubscriptionManagement(ctx: Context, pkg: String, productId: String?) {
    val base = "https://play.google.com/store/account/subscriptions"
    val uri = Uri.parse(
        if (productId != null) "$base?sku=$productId&package=$pkg" else base
    )
    ctx.startActivity(Intent(Intent.ACTION_VIEW, uri))
}

3.5 Verification checklist

  • Grace period path: trigger a test renewal failure, confirm SUBSCRIPTION_IN_GRACE_PERIOD arrives, verify entitlement stays on and the banner renders.
  • Hold path: wait for grace to expire, confirm SUBSCRIPTION_ON_HOLD arrives, verify entitlement is revoked and the hold screen blocks premium features.
  • Recovery path: fix the payment method, confirm SUBSCRIPTION_RENEWED arrives if recovering from grace or SUBSCRIPTION_RECOVERED if recovering from hold, verify flags clear, entitlement restores, and renewalDate equals the new expiryTime from SubscriptionPurchaseV2.
  • Terminal path: let account hold expire, confirm SUBSCRIPTION_CANCELED (3), then SUBSCRIPTION_EXPIRED (13) arrive, verify the resubscribe UI appears.
  • Silent window: confirm a fresh renewal failure does not fire SUBSCRIPTION_IN_GRACE_PERIOD immediately; the silent ~1 day must pass first.

References

Foire aux questions

À quoi sert la compétence IA Payment Recovery ?

Use this skill when handling failed subscription renewals on Google Play. Covers Grace Period (user keeps access), Account Hold (access revoked), the RTDN signals that move between stages, and the in app messaging required to drive recovery.

Pourquoi utiliser Payment Recovery sur TypingMind ?

Parce que vous l’installez une seule fois pour l’utiliser avec n’importe quel modèle. Payment Recovery se compose de simples instructions en Markdown plutôt que de code propre à un fournisseur. La même compétence fonctionne donc avec GPT-5, Claude, Gemini, Grok ou un modèle local, et vous pouvez changer de modèle en cours de discussion sans perturber son fonctionnement. TypingMind utilise vos propres clés API : vous payez donc directement les fournisseurs plutôt qu’un abonnement par siège, et vos compétences et discussions restent dans votre propre espace de stockage.

Comment installer Payment Recovery dans TypingMind ?

Dans TypingMind, ouvrez Plugins → Compétences → Installer depuis GitHub et collez https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/payment-recovery. TypingMind lit le fichier SKILL.md et l’installe sous forme de compétence que vous pouvez activer pour chaque discussion.

Quels modèles d’IA peuvent utiliser Payment Recovery ?

N’importe quel modèle que vous connectez dans TypingMind. Les compétences IA sont de simples instructions en Markdown, et non du code propre à un fournisseur. GPT, Claude, Gemini, Grok et les modèles locaux peuvent donc tous charger cette compétence lorsqu’une demande lui correspond.

Combien de modèles d’IA puis-je utiliser avec Payment Recovery ?

Autant que vous le souhaitez. Vous pouvez utiliser Payment Recovery avec tout modèle qui prend en charge les compétences : GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama et bien d’autres, le tout dans TypingMind avec vos propres clés API.

La compétence IA Payment Recovery est-elle gratuite ?

Oui. Cette compétence est publiée sur GitHub par RevenueCat sous licence Apache-2.0. Vous ne payez que votre propre fournisseur d’IA pour les tokens utilisés.

Que sont les compétences IA ?

Une compétence IA est un ensemble d’instructions réutilisables qui apprend à un modèle d’IA à accomplir une tâche précise. Elle suit le format ouvert Agent Skills : un fichier SKILL.md contenant un nom et une description, ainsi que les éventuels scripts, gabarits ou fichiers de référence dont le modèle peut avoir besoin. Le modèle ne lit les instructions que lorsque votre demande correspond à la compétence. Une compétence installée ne coûte donc rien tant qu’elle n’est pas utilisée.

En quoi les compétences IA diffèrent-elles des plugins ou des serveurs MCP ?

Un plugin ou un serveur MCP fournit au modèle de nouveaux outils à appeler : du code qui s’exécute quelque part et renvoie un résultat. Une compétence IA lui apporte plutôt des connaissances et une méthode : comment aborder une tâche, quelles étapes suivre et à quoi ressemble un bon résultat. Les compétences sont de simples instructions en Markdown. Elles ne nécessitent donc ni serveur, ni clé API, ni environnement d’exécution, et fonctionnent avec n’importe quel modèle.

Tout voir

Créez votre propre espace de travail IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇