Logo: Cancellations Pauses Winback

Cancellations Pauses Winback

Organisatioun
RevenueCat
cancellations-pauses-winback

Use this skill when implementing cancellations, developer initiated revocations, subscription pauses, and winback offers on Google Play. Covers user initiated cancellation, system cancellation, developer revoke/refund, pause resume flow, and winback API tools.

Iwwersiicht

EditeurRevenueCat
Repositoryplay-billing-skills
Skill-Nummcancellations-pauses-winback
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 Cancellations Pauses Winback 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/cancellations-pauses-winback
  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/cancellations-pauses-winback .claude/skills/cancellations-pauses-winback
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Cancellations Pauses Winback 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 Cancellations Pauses Winback automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Cancellations Pauses Winback 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.

Cancellations, Pauses, and Winback

A subscription can end in several ways, and each one has a different effect on user access, entitlement records, and recovery options. Use this skill when you are wiring up any end of life or pause flow for a Google Play subscription: user cancellation, developer cancellation, system cancellation after payment failure, pause, resume, restore, resubscribe, deferral, or revocation.

Phase 1: Identify the Scenario

Before writing any code, identify which of the following you are handling. The later phases branch on this choice.

  • The user is canceling through Play (silent to your app, signaled by RTDN).
  • You are canceling from your backend on the user's behalf or for your own reasons.
  • Google canceled after exhausting grace period and account hold.
  • The user is pausing, resuming, or a pause is scheduled.
  • The user is restoring a cancellation before expiry, or resubscribing after expiry.
  • You are deferring billing as goodwill or compensation.
  • You are revoking immediately due to fraud or a terms violation.

Phase 2: Plan by Cancellation Type

Each cancellation type behaves differently with respect to access, refunds, RTDN signals, and recovery. Plan the entitlement logic using the matrix below before you touch the API.

Cancellation type matrix

TypeAPI or TriggerAccess AfterRefundPrimary RTDNcanceledStateContext member
User initiatedPlay Subscriptions CenterUntil expiryTimeNone (prorated not issued)SUBSCRIPTION_CANCELEDuserInitiatedCancellation
Developer, user requestedpurchases.subscriptionsv2.cancel with USER_REQUESTED_STOP_RENEWALSUntil expiryTimeNoneSUBSCRIPTION_CANCELEDNot documented for this cancellationType; read whichever member is set
Developer, your reasonpurchases.subscriptionsv2.cancel with DEVELOPER_REQUESTED_STOP_PAYMENTSUntil expiryTimeNoneSUBSCRIPTION_CANCELEDdeveloperInitiatedCancellation
System, payment failureAutomatic after grace + account holdNone from the moment account hold expiresNoneSUBSCRIPTION_CANCELEDsystemInitiatedCancellation
Replacement (plan change)Plan change flowHandled by new tokenN/ASUBSCRIPTION_PURCHASED on the new token (linkedPurchaseToken = old token); old token may report SUBSCRIPTION_EXPIRED (DEFERRED)replacementCancellation
Revokepurchases.subscriptionsv2.revokeImmediately terminatedThe refund type you pass (fullRefund or proratedRefund)SUBSCRIPTION_REVOKEDn/a (terminated)

Pause versus cancel

SignalWhat it meansAccess
SUBSCRIPTION_PAUSE_SCHEDULE_CHANGEDPause scheduled, starts at end of current billing periodStill active, full access
SUBSCRIPTION_PAUSEDPause has begunRevoke access
SUBSCRIPTION_RECOVEREDPause ended, payment collectedRestore access
SUBSCRIPTION_RESTARTEDUser restored a cancellation before expiryTimeAccess uninterrupted, same token

Installment subscription caveat

During the commitment period of an installment plan, a user cancellation is either blocked outright or scheduled for after the commitment. A scheduled cancellation arrives as SUBSCRIPTION_CANCELLATION_SCHEDULED, not SUBSCRIPTION_CANCELED. Treat scheduled cancellation as "user intends to leave, still paying". Do not revoke access. The final SUBSCRIPTION_CANCELED arrives later when the commitment completes.

Entitlement rule that applies to every type

A canceled subscription with a future expiryTime is still an active subscription from the user's perspective. The only exceptions are revocation (immediate) and SUBSCRIPTION_PAUSED (immediate).

Phase 3: Execute

Use the snippets below as starting points. Each one matches a specific API call or RTDN handler from Phase 2.

Entitlement check that survives cancellation

kotlin
fun hasActiveSubscription(
    subscription: SubscriptionPurchaseV2
): Boolean {
    val now = System.currentTimeMillis()
    val expiry = subscription.lineItems
        .firstOrNull()
        ?.expiryTime
        ?.let { Instant.parse(it).toEpochMilli() } ?: return false
    return now < expiry
}

Inspect canceledStateContext to segment churn

kotlin
fun logCancellationReason(
    subscription: SubscriptionPurchaseV2
) {
    val context = subscription.canceledStateContext ?: return
    when {
        context.userInitiatedCancellation != null -> analytics.trackChurn(
            reason = "user",
            surveyResponse = context.userInitiatedCancellation.cancelSurveyResult?.reason
        )
        context.systemInitiatedCancellation != null -> analytics.trackChurn(reason = "payment_failure")
        context.developerInitiatedCancellation != null -> analytics.trackChurn(reason = "developer")
        context.replacementCancellation != null -> Unit // plan change, not churn
    }
}

This mapping is what drives later winback decisions. A "too expensive" survey answer is a discount candidate. A payment failure is a payment update prompt. A fraud cancellation is not a winback candidate.

Developer initiated cancellation

Call purchases.subscriptionsv2.cancel with the package name, purchase token, and body {"cancellationContext": {"cancellationType": ...}}:

  • USER_REQUESTED_STOP_RENEWALS when the user asked you to cancel (the user can restore it).
  • DEVELOPER_REQUESTED_STOP_PAYMENTS when you are canceling for your own reasons (cannot be restored; for installments it stops the next payment).

Both leave access intact until expiryTime. Store the cancellationType you sent and your own reason at cancel time: developerInitiatedCancellation has no fields, so canceledStateContext alone cannot tell the two apart.

Pause RTDN handler

kotlin
fun handlePauseNotification(
    notificationType: Int,
    purchaseToken: String
) {
    when (notificationType) {
        11 -> markPauseScheduled(purchaseToken) // PAUSE_SCHEDULE_CHANGED
        10 -> revokeAccess(purchaseToken)       // PAUSED
        1  -> grantAccess(purchaseToken)        // RECOVERED
    }
}

Surface paused subscriptions on the client (PBL 8.1+)

kotlin
val params = QueryPurchasesParams.newBuilder()
    .setProductType(ProductType.SUBS)
    .includeSuspendedSubscriptions(true)
    .build()

val result = billingClient.queryPurchasesAsync(params)

Check purchase.isSuspended: when true, do not grant access. It covers both paused and account hold, so use a neutral "resume or fix payment" call to action to the subscriptions center, or ask your backend which state it is.

Restore before expiry

kotlin
fun handleSubscriptionRestarted(purchaseToken: String) {
    val record = database.findByPurchaseToken(purchaseToken) ?: return
    record.canceledAt = null
    record.status = "ACTIVE"
    database.update(record)
}

The purchase token does not change on restore.

Link a resubscribe to the original account

kotlin
fun handleResubscribe(new: SubscriptionPurchaseV2, newToken: String) {
    // Read before acknowledging: outOfAppPurchaseContext is removed after acknowledgement.
    val ctx = new.outOfAppPurchaseContext
    val user = ctx?.expiredExternalAccountIdentifiers?.obfuscatedExternalAccountId
        ?.let { database.findByObfuscatedAccountId(it) }
        ?: ctx?.expiredPurchaseToken?.let { database.findUserByPurchaseToken(it) }
    if (user != null) {
        database.addSubscription(user.id, newToken, "ACTIVE")
    } else {
        handleNewSubscription(new)
    }
}

Prerequisite: set BillingFlowParams.Builder.setObfuscatedAccountId(hashedUserId) on the original purchase. Without it, expiredExternalAccountIdentifiers carries no account ID; fall back to expiredPurchaseToken.

Defer billing

kotlin
fun deferSubscription(packageName: String, purchaseToken: String) {
    val sub = playApi.purchases().subscriptionsv2().get(packageName, purchaseToken).execute()
    val request = DeferSubscriptionPurchaseRequest().setDeferralContext(
        DeferralContext()
            .setEtag(sub.etag)                       // required, from subscriptionsv2.get
            .setDeferDuration("${14 * 24 * 3600}s")  // relative, 1 day to 1 year per call
    )
    playApi.purchases().subscriptionsv2()
        .defer(packageName, purchaseToken, request)
        .execute() // returns itemExpiryTimeDetails[] with each item's new expiryTime
}

Constraints: deferDuration from 1 day to 1 year per call; all items in a subscription with add ons move by the same duration. Deferral keeps the same token and can be applied multiple times. It does not work on canceled subscriptions.

Revoke immediately

kotlin
fun revokeSubscription(
    packageName: String,
    purchaseToken: String,
    reason: String
) {
    val request = RevokeSubscriptionPurchaseRequest().setRevocationContext(
        RevocationContext().setProratedRefund(RevocationContextProratedRefund())
    )
    playApi.purchases().subscriptionsv2()
        .revoke(packageName, purchaseToken, request)
        .execute()
    database.findByPurchaseToken(purchaseToken)?.let {
        it.status = "REVOKED"
        it.revokeReason = reason // local analytics only; the API call itself carries no reason
        database.update(it)
    }
}

Revocation is appropriate for confirmed fraud, serious terms of service violations, or proactive chargeback response. It is not a substitute for a standard cancel plus refund. Google issues the refund type you chose (fullRefund or proratedRefund) and sends SUBSCRIPTION_REVOKED so your backend can reconcile even if the local write failed. itemBasedRefund {productId} is different: it revokes and fully refunds one item of a subscription with add ons, and the subscription stays active while other items remain.

Winback Eligibility Checks

Use the canceledStateContext member from Phase 3 to decide who is eligible for a winback offer:

  • userInitiatedCancellation with a price related survey answer: discount offer.
  • systemInitiatedCancellation: payment method update prompt, not a discount.
  • developerInitiatedCancellation where your own records show you canceled for fraud or TOS: exclude from winback.
  • replacementCancellation: not a churn event, exclude.

A paused subscriber is not a winback candidate either. They have already signaled intent to return, so the right surface is a resume prompt, not a discount.

References

Heefeg gestallte Froen

Wat mécht de KI-Skill Cancellations Pauses Winback?

Use this skill when implementing cancellations, developer initiated revocations, subscription pauses, and winback offers on Google Play. Covers user initiated cancellation, system cancellation, developer revoke/refund, pause resume flow, and winback API tools.

Firwat Cancellations Pauses Winback op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Cancellations Pauses Winback 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 Cancellations Pauses Winback 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/cancellations-pauses-winback 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 Cancellations Pauses Winback 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 Cancellations Pauses Winback benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Cancellations Pauses Winback 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 Cancellations Pauses Winback 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 👇