Logo de Subscription State Diagram

Subscription State Diagram

Organização
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

Visão geral

Publicado porRevenueCat
Repositórioplay-billing-skills
Nome da habilidadesubscription-state-diagram
Estrelas
58
Forks
0
Arquivos incluídos
Somente instruções
LicençaApache-2.0
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    As habilidades de IA são escritas em Markdown simples, não em código específico de um provedor. Por isso, funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • Sem arquivos extras

    Tudo de que o modelo precisa está nas instruções — sem arquivos extras para sincronizar.

  • Código aberto

    Publicada por RevenueCat no GitHub. Leia os arquivos da habilidade antes de instalá-la.

Instalação

Instale a habilidade de IA Subscription State Diagram no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL abaixo, que aponta para a pasta da habilidade, e confirme.
    https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/subscription-state-diagram
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Adicionar habilidade → Via URL do GitHub. Depois, cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse 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
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Subscription State Diagram em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Subscription State Diagram automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Subscription State Diagram não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo 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

Perguntas frequentes

O que a habilidade de IA Subscription State Diagram faz?

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.

Por que usar Subscription State Diagram no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. A habilidade Subscription State Diagram é escrita em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. No TypingMind, você usa suas próprias chaves de API e paga diretamente aos provedores, em vez de pagar uma assinatura por licença de usuário. Suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Subscription State Diagram no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/subscription-state-diagram. O TypingMind lê o arquivo SKILL.md e instala a habilidade para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Subscription State Diagram?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Subscription State Diagram?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Subscription State Diagram com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Subscription State Diagram é gratuita?

Sim. A habilidade é publicada no GitHub por RevenueCat sob a licença Apache-2.0. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, templates ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas que ele pode acionar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA dá ao modelo o conhecimento e as orientações de que ele precisa: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver lista completa

Crie seu próprio espaço de trabalho com IA agora

Inscreva-se na nossa newsletter para receber avisos sobre novos recursos e futuros sorteios 👇