Logo di Subscription State Diagram

Subscription State Diagram

Organizzazione
RevenueCat
subscription-state-diagram

Use this skill as the pull out reference for the full Google Play subscription state machine, showing every state and every RTDN triggered transition in one diagram.

Add to TypingMind

Panoramica

Pubblicato daRevenueCat
Repositoryplay-billing-skills
Nome della skillsubscription-state-diagram
Stelle
58
Fork
0
File inclusi
Solo istruzioni
LicenzaApache-2.0
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da RevenueCat su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Subscription State Diagram in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/subscription-state-diagram
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'agente.

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/subscription-state-diagram .claude/skills/subscription-state-diagram
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Subscription State Diagram in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Subscription State Diagram non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Subscription State Diagram non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Subscription State Diagram

Phase 0: Intent

Use this skill when you need a single place to look up:

  • What states a Google Play subscription can be in.
  • Which RTDN (Real Time Developer Notification) moves a subscription from one state to the next.
  • Whether a given state grants access to paid content.
  • What token behavior to expect across renewals, pauses, holds, and resubscribes.

This is a reference skill. It does not write code for you. It hands you the map so you can point at a node, point at an edge, and then make a decision about access or acknowledgement.

Phase 1: Locate

Tell the skill which part of the state machine you care about. Pick the shortest path that matches your question.

You want to know...Jump to
What every state means and whether it grants accessStates at a Glance
Which RTDN fires on a specific transitionTransition Table
Whether to grant access right nowAccess Decision Flowchart
What happens to the purchase token across eventsToken Lifecycle
The numeric code for a notification typeRTDN Quick Reference
How long grace period, account hold, or token validity lastsTime Windows

A typical lookup looks like this:

  1. Name the current state (for example IN_GRACE_PERIOD).
  2. Name the event you observed (for example RTDN type 5).
  3. Find the row in the From IN_GRACE_PERIOD table.
  4. Read the target state and the access rule.

Phase 2: Reference Diagram

States at a Glance

StateAccessDescription
PENDINGNoPurchase initiated, payment not yet processed
PENDING_PURCHASE_CANCELEDNoPending transaction canceled; if linkedPurchaseToken is set, the previous subscription is unaffected
ACTIVEYesSubscription is paid and current
IN_GRACE_PERIODYesPayment failed, Google is retrying, user keeps access
ON_HOLDNoGrace period expired, access revoked, awaiting payment fix
PAUSEDNoUser requested pause, access revoked
CANCELEDUntil expiryCanceled but not expired, access until expiryTime
EXPIREDNoSubscription has ended

Transition Table

Every edge in the diagram. Columns: origin state, destination state, trigger, RTDN name and numeric type.

FromToTriggerRTDN
PENDINGACTIVEPayment completesSUBSCRIPTION_PURCHASED (4)
PENDINGPENDING_PURCHASE_CANCELEDPending payment canceled or expiredSUBSCRIPTION_PENDING_PURCHASE_CANCELED (20)
ACTIVEACTIVESuccessful renewalSUBSCRIPTION_RENEWED (2)
ACTIVEIN_GRACE_PERIODRenewal fails, grace period enabledSUBSCRIPTION_IN_GRACE_PERIOD (6)
ACTIVEON_HOLDRenewal fails, no grace, account hold enabledSUBSCRIPTION_ON_HOLD (5)
ACTIVECANCELEDUser or developer cancelsSUBSCRIPTION_CANCELED (3)
ACTIVEEXPIREDRevoked or refundedSUBSCRIPTION_REVOKED (12)
ACTIVEPAUSEDPause takes effect at end of periodSUBSCRIPTION_PAUSED (10)
IN_GRACE_PERIODACTIVEPayment recovered (renewal date unchanged)SUBSCRIPTION_RENEWED (2)
IN_GRACE_PERIODON_HOLDGrace expires without paymentSUBSCRIPTION_ON_HOLD (5)
IN_GRACE_PERIODEXPIREDGrace expires, no account holdSUBSCRIPTION_EXPIRED (13)
ON_HOLDACTIVEUser fixes paymentSUBSCRIPTION_RECOVERED (1)
ON_HOLDEXPIREDAccount hold period expiresSUBSCRIPTION_CANCELED (3), then SUBSCRIPTION_EXPIRED (13)
PAUSEDACTIVEPause ends, payment succeedsSUBSCRIPTION_RECOVERED (1)
PAUSEDON_HOLDPause ends, payment failsSUBSCRIPTION_ON_HOLD (5)
CANCELEDACTIVEUser restores before expirationSUBSCRIPTION_RESTARTED (7)
CANCELEDEXPIREDexpiryTime reachedSUBSCRIPTION_EXPIRED (13)
EXPIREDACTIVEUser resubscribes, new purchase tokenSUBSCRIPTION_PURCHASED (4)

RTDN Quick Reference by Number

#NameCommon Usage
1RECOVEREDRestore access after hold or pause
2RENEWEDExtend access period
3CANCELEDNote cancellation, keep access until expiry
4PURCHASEDNew subscription, grant access
5ON_HOLDRevoke access
6IN_GRACE_PERIODKeep access, warn user
7RESTARTEDRestore access, same token
8PRICE_CHANGE_CONFIRMEDDeprecated
9DEFERREDExtend billing date
10PAUSEDRevoke access at period end
11PAUSE_SCHEDULE_CHANGEDCheck pause status
12REVOKEDImmediately revoke access
13EXPIREDRevoke access, clean up
17ITEMS_CHANGEDCheck updated line items
18CANCELLATION_SCHEDULEDNote scheduled cancellation
19PRICE_CHANGE_UPDATEDCheck price change details
20PENDING_PURCHASE_CANCELEDClean up pending records
22PRICE_STEP_UP_CONSENT_UPDATEDCheck consent status

Time Windows

WindowDurationWhat Happens
Acknowledgement3 daysUnacknowledged purchases auto refund
Grace period0 to 30 days (not longer than the billing period), configurableUser keeps access while Google retries
Silent grace period1 day minimumApplies even when grace is set to 0 days
Account hold0 to 60 days; default 60 minus grace; grace + hold total 30 to 60 daysUser loses access, can recover by fixing payment
Token validity60 days post expirationAPI calls still succeed in this window
Pause duration1 week to 3 monthsDepends on billing period

Phase 3: Handling Guidance Per Transition

Each row tells you what to do when the RTDN lands. Pair this with the access rule in Phase 2.

TransitionYour handler should
PENDING to ACTIVEAcknowledge within 3 days, provision entitlement, store the purchase token
PENDING to PENDING_PURCHASE_CANCELEDClean up the pending record, do not provision; for a pending plan change or top up keep the old token's entitlement
ACTIVE to ACTIVE (renewal)Extend the entitlement to the new expiryTime, keep the same token
ACTIVE to IN_GRACE_PERIODKeep access on, surface a payment warning, trigger In App Messaging
ACTIVE to ON_HOLDRevoke access, tell the user to fix payment in Play
ACTIVE to CANCELEDKeep access until expiryTime, show an expiry countdown, log the cancel reason
ACTIVE to EXPIRED (revoke)Revoke access immediately, note the refund or revocation
ACTIVE to PAUSEDAccess ends at period end, show resume date on next open
IN_GRACE_PERIOD to ACTIVEClear the warning banner, confirm expiryTime moved forward
IN_GRACE_PERIOD to ON_HOLDRevoke access, swap the warning for a fix payment prompt
IN_GRACE_PERIOD to EXPIREDRevoke access, offer resubscribe
ON_HOLD to ACTIVERestore the entitlement, keep the existing token
ON_HOLD to EXPIREDRevoke, offer resubscribe, stop polling the token after 60 days
PAUSED to ACTIVERestore access, same token
PAUSED to ON_HOLDKeep access revoked, switch message to fix payment
CANCELED to ACTIVERestore, same token, remove the expiry countdown
CANCELED to EXPIREDRevoke, offer resubscribe
EXPIRED to ACTIVETreat as a new purchase, new token, link it to the prior user identity

Access Decision

Use the same rule across every handler.

kotlin
fun shouldGrantAccess(
    state: String,
    expiryTimeMillis: Long
): Boolean = when (state) {
    "SUBSCRIPTION_STATE_ACTIVE",
    "SUBSCRIPTION_STATE_IN_GRACE_PERIOD" -> true
    "SUBSCRIPTION_STATE_CANCELED" ->
        System.currentTimeMillis() < expiryTimeMillis
    else -> false
}

Token Lifecycle

EventToken Behavior
New purchaseNew token
RenewalSame token, new Order ID
Upgrade or downgradeNew token, old token linked via linkedPurchaseToken
Restore before expirySame token
Resubscribe after expiryNew token
Pause and resumeSame token
Grace period recoverySame token
Account hold recoverySame token

References

Domande frequenti

Cosa fa la skill IA Subscription State Diagram?

Use this skill as the pull out reference for the full Google Play subscription state machine, showing every state and every RTDN triggered transition in one diagram.

Perché usare Subscription State Diagram su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Subscription State Diagram è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Subscription State Diagram in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/subscription-state-diagram. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Subscription State Diagram?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Subscription State Diagram?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Subscription State Diagram: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Subscription State Diagram è gratuita?

Sì. È pubblicata su GitHub da RevenueCat con licenza Apache-2.0. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇