RevenueCat ユーザーが現在、購入権(ユーザーが購入した機能を使う権利)を通じて有料機能にアクセスできるかどうかを確認します。 **次のような場合に使用:** - ユーザーに機能をプレミアム版のみに制限したい場合 - ユーザーがプロ版のサブスクリプションを持っているかを確認したい場合 - 顧客情報から有効な購入権を読み込みたい場合 - サブスクリプション状態に基づいて機能を表示・非表示にしたい場合 - 購入権の変更に対応したい場合 - 「ユーザーはサブスクリプション登録しているか」を判定したい場合 iOS、Android、Kotlin Multiplatform、Flutter、React Native に対応しています。
Check whether a RevenueCat user currently has access to a paid feature via entitlements. Use when the user asks to gate a feature behind premium, check if the user has a pro subscription, read customerInfo active entitlements, show or hide a feature based on subscription status, react to entitlement changes, or 'is the user subscribed' on iOS, Android, Kotlin Multiplatform, Flutter, or React Native.
次のような場合に使用:
ユーザーが、有効な RevenueCat エンタイトルメントに基づいて機能の表示・非表示を制御したい場合。
このスキルは、ワンショットチェックとリアクティブリスナーをカバーします。
購入フロー(revenuecat-purchase-flow を参照)や認証(revenuecat-identify-user を参照)はカバーしません。
作業ディレクトリを調べ、上から順に最初にマッチした項目を採用してください:
package.json に react-native-purchases のエントリ、または依存関係に react-native がある → platforms/react-native.md を読む。expo も依存関係にある場合は、Expo プロジェクトとして記録する。pubspec.yaml が存在する → platforms/flutter.md を読む。build.gradle.kts に kotlin { … } のマルチプラットフォームソースセットブロックがある、または com.revenuecat.purchases:purchases-kmp* に依存している → platforms/kmp.md を読む。build.gradle(.kts) が com.android.application を適用している(かつ KMP ではない)→ platforms/android.md を読む。Package.swift、*.xcodeproj、*.xcworkspace、または Podfile がある → platforms/ios.md を読む。複数マッチする場合(例: Flutter プロジェクト内の ios/ フォルダ)は、ビルドを管理している最も外側のプロジェクトを選択してください。
それでも判断できない場合は、ユーザーにどのプラットフォームを設定するか確認してください。
プロダクト ID ではなく、エンタイトルメント識別子を確認すること。
識別子(例: "premium")は RevenueCat ダッシュボードで設定され、1 つ以上のプロダクトにマッピングされます。
エンタイトルメントを使用することで、アプリのコードに触れることなく、プロダクト・価格・ストアを変更できます。
customerInfo.entitlements.active が信頼できる唯一の情報源です。
これはエンタイトルメント識別子をキーとした Map<String, EntitlementInfo> です。
active に存在する = ユーザーが現在アクセス権を持っている。存在しない = 過去の購入履歴にかかわらず、アクセス権がない。
購入履歴を元にゲートを設けないこと。
期限切れのサブスクリプションは customerInfo.entitlements.all には残りますが、active からは除外されます。
必ず active のみを使用してください。
最初に 1 回取得し、その後はサブスクライブすること。
初回の customerInfo 呼び出しはキャッシュされた値を素早く返し、SDK はバックグラウンドで更新を行います。
すべての SDK は、エンタイトルメントに変化が生じた際(購入・復元・更新・期限切れの後)に発火するリスナーまたはストリームを提供しています。
ポーリングではなく、このリスナーをサブスクライブしてください。
SDK が事前に設定されている必要があります。
Purchases.configure(…) が実行されていない場合、エンタイトルメントの呼び出しは失敗します。
このスキルを使用する前に、integrate-revenuecat を通じて SDK をセットアップしてください。
検出結果に対応するプラットフォームファイルを読んでください:
platforms/ios.mdplatforms/android.mdplatforms/kmp.mdplatforms/flutter.mdplatforms/react-native.md各プラットフォームファイルには、ワンショットチェック、リアクティブサブスクリプション、および典型的なアプリでのそれぞれの配置場所が記載されています。
以下をすべて確認するまで、ゲートが機能していると判断しないでください:
Use this skill when the user wants to decide whether to show or hide a feature based on an active RevenueCat entitlement. The skill covers the one shot check and the reactive listener; it does not cover purchasing (see revenuecat-purchase-flow) or auth (revenuecat-identify-user).
Inspect the working directory and pick the first match, from top to bottom:
package.json has a react-native-purchases entry, or react-native as a dependency → read platforms/react-native.md. If expo is also a dependency, note it as an Expo project.pubspec.yaml exists at the project root → read platforms/flutter.md.build.gradle.kts contains a kotlin { … } multiplatform source sets block, or depends on com.revenuecat.purchases:purchases-kmp* → read platforms/kmp.md.build.gradle(.kts) applies com.android.application (and is not KMP) → read platforms/android.md.Package.swift, *.xcodeproj, *.xcworkspace, or Podfile at the project root → read platforms/ios.md.If several match (e.g. an ios/ folder inside a Flutter project), pick the outermost project, the one that owns the build. If still ambiguous, ask the user which platform they want to configure.
"premium") is configured in the RevenueCat dashboard and mapped to one or more products. Using the entitlement lets you change products, prices, and stores without touching app code.customerInfo.entitlements.active is the source of truth. It is a Map<String, EntitlementInfo> keyed by entitlement identifier. Presence in active means the user currently has access. Absence means they do not, regardless of past purchases.customerInfo.entitlements.all but drop out of active. Use active only.customerInfo call returns a cached value quickly, and the SDK refreshes in the background. Every SDK exposes a listener or stream that fires when entitlements change (after a purchase, restore, renewal, or expiration). Subscribe to that instead of polling.Purchases.configure(…) has not run, the entitlement call will fail. Set up the SDK via integrate-revenuecat before using this skill.Read the platform file that matches detection:
platforms/ios.mdplatforms/android.mdplatforms/kmp.mdplatforms/flutter.mdplatforms/react-native.mdEach platform file shows the one shot check, the reactive subscription, and where to place each in a typical app.
Do not claim the gate works until:
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。