🧪revenuecat-testing-setup
- プラグイン
- rc
- ソース
- GitHub で見る ↗
説明
実際の課金なしにRevenueCatの購入機能をテストするための環境をセットアップします。 次のような場合に使用: ユーザーがRevenueCatの購入テスト、サンドボックスのセットアップ、StoreKit設定ファイル、ライセンステスター、実際のお金を使わずに購入をテストする方法、サンドボックスアカウントのセットアップ、内部テストトラック、またはiOS・Android・Kotlin Multiplatform・Flutter・React Nativeでのペイウォールのテストについて言及した場合。
原文を表示
Set up a testing environment for RevenueCat purchases without charging real money. Use when the user says test RevenueCat purchases, sandbox setup, StoreKit configuration file, license tester, how do I test purchases without real money, set up sandbox account, internal testing track, or test paywall on iOS, Android, Kotlin Multiplatform, Flutter, or React Native.
ユースケース
- ✓RevenueCatの購入機能をテストするとき
- ✓サンドボックス環境をセットアップするとき
- ✓実際の課金なしで購入をテストするとき
- ✓ペイウォール機能の動作確認を行うとき
本文(日本語訳)
revenuecat-testing-setup: RevenueCat 購入のテスト環境をセットアップする
次のような場合に使用: ユーザーが実際の課金なしに RevenueCat に対して購入をテストしたいとき。 各ストアにはそれぞれ独自のテストチャネルがあり、チャネルごとに再現精度(フィデリティ)と反復コストが異なります。
1. プラットフォームの検出
作業ディレクトリを確認し、以下の順番で最初に一致するものを選択してください:
- React Native:
package.jsonにreact-native-purchasesのエントリがある、またはreact-nativeが依存関係に含まれている →platforms/react-native.mdを読む。expoも依存関係にある場合は、Expo プロジェクトとして記録する。 - Flutter: プロジェクトルートに
pubspec.yamlが存在する →platforms/flutter.mdを読む。 - Kotlin Multiplatform:
build.gradle.ktsにkotlin { … }のマルチプラットフォームソースセットブロックが含まれている、またはcom.revenuecat.purchases:purchases-kmp*に依存している →platforms/kmp.mdを読む。 - Android(ネイティブ):
build.gradle(.kts)がcom.android.applicationを適用している(かつ KMP ではない)→platforms/android.mdを読む。 - iOS(ネイティブ): プロジェクトルートに
Package.swift、*.xcodeproj、*.xcworkspace、またはPodfileが存在する →platforms/ios.mdを読む。
複数が一致する場合(例: Flutter プロジェクト内に ios/ フォルダがある場合)は、ビルドを管理している最も外側のプロジェクトを選択してください。
それでも判断できない場合は、どのプラットフォームを設定したいかユーザーに確認してください。
2. 共通コンセプト(全プラットフォーム共通)
開発中は実際の課金を行えません
各ストアには専用のテストチャネルが用意されています。 適切なチャネルの選択は、何をテストしたいかによって異なります。
テストチャネル: フィデリティ vs 反復コスト
フィデリティが高いほど実際の購入パイプラインをより忠実に再現します。 フィデリティが低いほど高速に反復できます。
-
RevenueCat Test Store(最低フィデリティ・最速反復・決定論的) RevenueCat がホストする合成ストアです。SDK はダッシュボードの
test_…API キーで設定します。購入時に Test Store ダイアログが開き、結果を手動で選択します(購入成功・購入失敗・キャンセル)。購入はエンタイトルメントをトリガーし、CustomerInfoを更新し、ダッシュボードに表示されますが、Apple や Google への実際の呼び出しは発生しません。ペイウォールの UI 反復・インテグレーションテスト・CI のスモークランに最適です。 -
iOS StoreKit Configuration File(低フィデリティ・Apple 合成) Xcode がローカルでストアをスタブします。App Store Connect へのラウンドトリップなしに購入が即座に成功します。StoreKit 固有の動作が必要な場合に有用です。このモードの RevenueCat トランザクションは、SDK バージョンやルーティング設定によってダッシュボードに表示される場合とそうでない場合があるため、ダッシュボードの忠実なテストとしては適していません。
-
iOS Sandbox(実際の Sandbox Apple ID)/ Android Internal Testing(ライセンステスター) 実際のストアバックエンド・実際の RevenueCat ダッシュボードへの取り込み・実際のレシートを使用します。反復速度は遅め: ビルド・インストール・Play の伝播や App Store Connect へのプロダクト登録を待つ必要があります。
-
TestFlight(iOS)/ クローズドまたはオープンテスト(Android) 本番環境に非常に近い挙動をします。レシートは本番スタイルです。トランザクションは RevenueCat ダッシュボードの Sandbox ビューではなく、本番ビューに反映されます。
-
本番(Production) 実際の課金が発生します。テストには使用しないでください。
まずは目的に応えられる最低フィデリティのチャネルから始め、必要に応じて上位に移行してください。 UI やペイウォールの反復は高速チャネルで行い、「エンタイトルメントが実際に切り替わるか?」の確認は Sandbox または Internal Testing で行います。
Test Store: Sandbox より先に検討すべきケース
RevenueCat の Test Store は、ダッシュボード上でプロジェクトごとに設定する合成ストアプロバイダーです。
App Store や Google Play を呼び出すことなく、実際の RevenueCat バックエンドレコード(CustomerInfo の更新・エンタイトルメントの遷移・ダッシュボードトランザクション)を生成します。
その速度の代償はフィデリティです。Test Store は以下をシミュレートしません:
- Ask to Buy の承認フロー
- 地域別価格設定
- サーバーサイドのレシート検証の詳細
- ストアレベルのレビューや拒否フロー
- サブスクリプションの完全な更新サイクル(Test Store は圧縮されたクロックで最大 5 回の更新)
UI の高速反復・決定論的な結果が必要なインテグレーションテスト・CI チェックには Test Store を使用してください。 ストア側の動作を検証する場合は、App Store Sandbox または Google Play Internal Testing に移行してください。
セットアップ方法:
ダッシュボードで Apps and providers → Test configuration セクション → Test Store → Create / Enable に移動します。
Test Store の API キーは Project Settings → API keys に test_ プレフィックス付きで表示されます。
デバッグビルドにはテストキー、リリースビルドには本番キー(appl_… / goog_…)を使用するよう SDK を設定してください。
プラットフォーム別のキー切り替えパターンは各プラットフォームファイルに記載されています。
Test Store キーは絶対に本番環境に含めないでください。 リリースバイナリが Test Store を経由しないよう、ビルド設定でキーを必ずゲートしてください。
Sandbox トランザクションはダッシュボードで別途表示されます
RevenueCat ダッシュボードには Sandbox と Production のビュー切り替えがあります。
Sandbox での購入は Sandbox ビューにのみ表示されます。
テストトランザクションが表示されない場合、SDK がレポートできていないか(API キー・configure 呼び出し・ネットワークを確認してください)、または購入が RevenueCat のバックエンドに到達しない StoreKit 設定ファイルに対して行われている可能性があります。
Sandbox での更新サイクルの加速
Sandbox ではサブスクリプションの更新が加速されたテストクロックで実行されます。 これにより、数週間ではなく数分で更新ロジックを検証できます。
-
iOS Sandbox の更新サイクル(Apple のドキュメントより): 日次 → 3 分ごと、週次 → 3 分ごと、月次 → 5 分ごと、2 ヶ月 → 10 分ごと、3 ヶ月 → 15 分ごと、6 ヶ月 → 30 分ごと、年次 → 1 時間ごと。 サブスクリプションは最大 6 回自動更新された後に期限切れになります。
-
Android Sandbox の更新サイクルは Google Play Console → Subscriptions testing に記載されています。 ライセンステスターのサブスクリプションも同じ加速クロックで更新されます。
初回購入フローには新規テストユーザーを使用する
購入履歴はテストアカウント(Sandbox Apple ID またはライセンステスターの Gmail)に紐付けられ、永続します。 すでに使用済みのアカウントで「初回購入」ロジック・入門オファー・無料トライアルをテストすると、誤った結果が生じます。 クリーンな初回購入シナリオのために、新しい Sandbox テスターを作成してください。
デバイスではなくダッシュボードで確認する
デバイス上で購入が成功することは、RevenueCat がそれを記録したこととは異なります。 必ず以下を確認してください:
- トランザクションが RevenueCat ダッシュボード(Sandbox ビュー)に表示されている
- 期待する
appUserIDがそのトランザクションを所有している - 期待するエンタイトルメントがそのユーザーに対してアクティブになっている
デバイスが成功を示しているのにダッシュボードに何も表示されない場合、問題はストアではなく設定パスにあります。
3. 実装
検出結果に対応するプラットフォームファイルを読んでください:
platforms/ios.mdplatforms/android.mdplatforms/kmp.mdplatforms/flutter.mdplatforms/react-native.md
4. 検証
以下の条件がすべて満たされた時点で、テスト環境のセットアップは完了です:
- テストユーザーによるテスト購入がエンドツーエンドで成功する
- トランザクションが RevenueCat ダッシュボードの Sandbox ビューに表示され、ログインした
appUserIDに紐付けられている - 購入完了後、
customerInfoに期待するエンタイトルメントがアクティブになっている - アプリの新規インストール後に購入の復元を行うと、同じテストユーザーにエンタイトルメントが復元される
これら 4 つのステップのいずれかが失敗した場合、環境はまだ準備できていません。
一般的な根本原因については revenuecat-troubleshoot スキルを参照してください。
原文(English)を表示
revenuecat-testing-setup: set up a testing environment for RevenueCat purchases
Use this skill when the user wants to test purchases against RevenueCat without charging real money. Each store has its own testing channel, and each channel has different fidelity and iteration cost.
1. Detect the platform
Inspect the working directory and pick the first match, from top to bottom:
- React Native:
package.jsonhas areact-native-purchasesentry, orreact-nativeas a dependency → readplatforms/react-native.md. Ifexpois also a dependency, note it as an Expo project. - Flutter:
pubspec.yamlexists at the project root → readplatforms/flutter.md. - Kotlin Multiplatform:
build.gradle.ktscontains akotlin { … }multiplatform source sets block, or depends oncom.revenuecat.purchases:purchases-kmp*→ readplatforms/kmp.md. - Android (native):
build.gradle(.kts)appliescom.android.application(and is not KMP) → readplatforms/android.md. - iOS (native):
Package.swift,*.xcodeproj,*.xcworkspace, orPodfileat the project root → readplatforms/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.
2. Shared concepts (all platforms)
You cannot charge real money during development
Each store has a dedicated testing channel. Choosing the right channel depends on what you want to test.
Testing channels by fidelity vs iteration cost
Higher fidelity exercises more of the real purchase pipeline. Lower fidelity iterates faster.
- RevenueCat Test Store (lowest fidelity, fastest iteration, deterministic). A synthetic store hosted by RevenueCat. The SDK is configured with a
test_…API key from the dashboard. Purchases open a Test Store dialog where you pick the outcome by hand: Successful Purchase, Failed Purchase, or Cancel. Purchases trigger entitlements, updateCustomerInfo, and appear on the dashboard, but no Apple or Google call happens. Best for paywall iteration, integration tests, and CI smoke runs. - iOS StoreKit Configuration File (low fidelity, Apple synthetic). Xcode stubs the store locally. Purchases succeed instantly with no App Store Connect round trip. Useful when you need StoreKit specific behavior. RevenueCat transactions in this mode may or may not appear on the dashboard depending on SDK version and intended routing, so it is not a faithful dashboard test.
- iOS Sandbox (real sandbox Apple ID) / Android Internal Testing (license tester). Real store backends, real RevenueCat dashboard ingestion, real receipts. Slower to iterate: build, install, wait for Play propagation or App Store Connect to register the product.
- TestFlight (iOS) / Closed or Open Testing (Android). Behaves very close to production. Receipts are production style. Transactions land in the production RevenueCat dashboard, not the Sandbox view.
- Production. Real money. Do not use for testing.
Start with the lowest fidelity that answers the question, then move up. UI and paywall iteration belongs in the fast channel. "Does my entitlement actually flip?" belongs in sandbox or internal testing.
Test Store: when to reach for it before sandbox
RevenueCat's Test Store is a synthetic store provider configured per project on the dashboard. It produces real RevenueCat backend records (CustomerInfo updates, entitlement transitions, dashboard transactions) without calling App Store or Google Play. The price of that speed is fidelity. Test Store does not simulate Ask to Buy approval flows, region specific pricing, server side receipt validation specifics, store level review or rejection paths, or full subscription renewal cadence (Test Store renews up to five times on a compressed clock).
Use Test Store when you want to iterate on UI quickly, write integration tests with deterministic outcomes, or run CI checks. Move up to App Store Sandbox or Google Play Internal Testing for anything that exercises store side behavior.
Setup. In the dashboard, go to Apps and providers → Test configuration section → Test Store → Create / Enable. The Test Store API key appears under Project Settings → API keys with a test_ prefix. Configure the SDK with the test key in debug builds and the production key (appl_… / goog_…) in release builds. The platform files show the per platform key swap pattern.
Test Store keys must never ship to production. Gate the key behind your build configuration so release binaries cannot route through Test Store.
Sandbox transactions appear separately on the dashboard
The RevenueCat dashboard has a toggle between Sandbox and Production views. Sandbox purchases only appear under Sandbox. If a test transaction does not appear there, the SDK is not reporting it (check API key, configure call, and network), or the purchase was against a StoreKit config file that does not hit RevenueCat's backend.
Accelerated renewal in sandbox
Subscription renewals run on accelerated test clocks in sandbox. This lets you exercise renewal logic in minutes instead of weeks.
- iOS sandbox renewal cadence (per Apple's documentation): daily → every 3 minutes, weekly → every 3 minutes, monthly → every 5 minutes, 2 months → every 10 minutes, 3 months → every 15 minutes, 6 months → every 30 minutes, yearly → every hour. Subscriptions auto-renew a maximum of 6 times then expire.
- Android sandbox renewal cadence is documented in Google Play Console → Subscriptions testing. License tester subscriptions renew on the same accelerated clock.
Use a fresh test user for first purchase flows
Purchase history is attached to the test account (sandbox Apple ID or license tester Gmail) and persists. Testing "first purchase" logic, introductory offers, or free trials against an account that has already used them produces misleading results. Create a new sandbox tester for clean first purchase scenarios.
Confirm against the dashboard, not the device
A purchase succeeding on the device is not the same as RevenueCat recording it. Always confirm:
- The transaction appears on the RevenueCat dashboard (Sandbox view).
- The expected appUserID owns the transaction.
- The expected entitlement is now active on that user.
If the device shows success but the dashboard shows nothing, something is wrong in the configuration path, not the store.
3. Implementation
Read the platform file that matches detection:
platforms/ios.mdplatforms/android.mdplatforms/kmp.mdplatforms/flutter.mdplatforms/react-native.md
4. Verify
Your testing environment is set up once:
- A test purchase succeeds end to end from a test user.
- The transaction appears on the RevenueCat dashboard Sandbox view, attached to the appUserID you logged in with.
- The expected entitlement is active on
customerInfoafter the purchase completes. - Restoring purchases on a fresh install of the app restores the entitlement to the same test user.
If any of those four steps fails, the environment is not ready. The revenuecat-troubleshoot skill covers the usual root causes.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。