Subscription State Diagramのロゴ

Subscription State Diagram

組織
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

概要

公開者RevenueCat
リポジトリplay-billing-skills
スキル名subscription-state-diagram
スター
58
フォーク
0
同梱ファイル
指示のみ
ライセンスApache-2.0
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    RevenueCatがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Subscription State Diagram」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/subscription-state-diagram
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

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
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでSubscription State Diagramを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にSubscription State Diagramを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Subscription State Diagramは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

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

よくある質問

AIスキル「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.

TypingMindでSubscription State Diagramを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Subscription State Diagramはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにSubscription State Diagramをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/RevenueCat/play-billing-skills/tree/main/google-play/subscription-state-diagramを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Subscription State Diagramを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Subscription State Diagramで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもSubscription State Diagramを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Subscription State Diagram」は無料ですか?

はい。RevenueCatがApache-2.0ライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇