Logo: Payment Recovery

Payment Recovery

Organisatioun
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

Iwwersiicht

EditeurRevenueCat
Repositoryplay-billing-skills
Skill-Nummpayment-recovery
Stären
58
Forks
0
Matgeliwwert Dateien
Nëmmen Instruktiounen
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    RevenueCat huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Payment Recovery an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/payment-recovery
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-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
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Payment Recovery an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Payment Recovery automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Payment Recovery net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

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

Heefeg gestallte Froen

Wat mécht de KI-Skill 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.

Firwat Payment Recovery op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Payment Recovery besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Payment Recovery an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/payment-recovery an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Payment Recovery benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Payment Recovery benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Payment Recovery domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Payment Recovery gratis?

Jo. RevenueCat huet de Skill ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇