🧪revenuecat-testing-setup
- プラグイン
- revenuecat
- ソース
- GitHub で見る ↗
説明
実際のお金を請求することなく、RevenueCat購入のテスト環境をセットアップします。 次のような場合に使用: ユーザーが「RevenueCatの購入をテストしたい」「Sandboxのセットアップ」「StoreKit設定ファイル」「ライセンステスター」「実際のお金を使わずに購入をテストするには」「Sandboxアカウントのセットアップ」「内部テストトラック」、または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購入をテストしたい
- ✓Sandboxのセットアップを行う
- ✓実際のお金を使わずテストする
- ✓ペイウォール機能を検証する
- ✓ライセンステスターで確認する
本文(日本語訳)
revenuecat-testing-setup: RevenueCat 購入のテスト環境をセットアップする
次のような場合に使用: ユーザーが実際の課金なしに RevenueCat に対して購入テストを行いたい場合。 各ストアにはそれぞれ専用のテストチャンネルがあり、再現精度(fidelity)と反復コストはチャンネルごとに異なります。
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. 共通コンセプト(全プラットフォーム共通)
開発中に実際の課金は発生させられない
各ストアには専用のテストチャンネルがあります。 どのチャンネルを使うかは、何をテストしたいかによって決まります。
テストチャンネル: 再現精度(fidelity)と反復コストの比較
再現精度が高いほど、実際の購入パイプラインをより忠実に検証できます。 再現精度が低いほど、反復速度は速くなります。
-
RevenueCat Test Store(最低再現精度・最速反復・決定論的) RevenueCat がホストする合成ストア。SDK はダッシュボードの
test_…API キーで設定します。 購入時に Test Store ダイアログが開き、結果を手動で選択できます(購入成功 / 購入失敗 / キャンセル)。 購入によりエンタイトルメントがトリガーされ、CustomerInfoが更新され、ダッシュボードにも反映されますが、Apple や Google への実際の呼び出しは発生しません。 ペイウォールの反復開発、インテグレーションテスト、CI スモークランに最適です。 -
iOS StoreKit 設定ファイル(低再現精度・Apple 合成) Xcode がストアをローカルでスタブします。App Store Connect へのラウンドトリップなしに購入が即座に成功します。 StoreKit 固有の動作を確認したい場合に有用です。 このモードでの RevenueCat トランザクションは、SDK バージョンおよびルーティングの設定によってダッシュボードに表示されない場合があるため、ダッシュボードの動作を忠実に検証するものではありません。
-
iOS Sandbox(実際のサンドボックス Apple ID)/ Android 内部テスト(ライセンステスター) 実際のストアバックエンド、実際の RevenueCat ダッシュボードへの取り込み、実際のレシートを使用します。 反復速度は遅め: ビルド、インストール、Play の伝播待ち、または App Store Connect での商品登録待ちが発生します。
-
TestFlight(iOS)/ クローズドまたはオープンテスト(Android) 本番環境に非常に近い動作をします。レシートは本番スタイルです。 トランザクションは Sandbox ビューではなく、RevenueCat ダッシュボードの本番ビューに記録されます。
-
本番(Production) 実際に課金が発生します。テスト目的では使用しないでください。
確認したい内容に対して最も再現精度の低いチャンネルから始め、必要に応じて上位に移行してください。 UI・ペイウォールの反復作業には高速チャンネルを使用し、「エンタイトルメントが実際に切り替わるか?」の確認にはサンドボックスまたは内部テストを使用してください。
Test Store: サンドボックスより先に検討すべき場面
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 内部テストに移行してください。
セットアップ手順:
ダッシュボードで Apps and providers → Test configuration セクション → Test Store → 作成 / 有効化 の順に進みます。
Test Store の API キーは Project Settings → API keys の下に test_ プレフィックス付きで表示されます。
デバッグビルドではテストキー、リリースビルドでは本番キー(appl_… / goog_…)を使用するよう SDK を設定してください。
各プラットフォームファイルにプラットフォームごとのキー切り替えパターンが記載されています。
Test Store キーは絶対に本番環境に配布してはなりません。 リリースバイナリが Test Store を経由できないよう、キーをビルド設定の条件で制御してください。
サンドボックストランザクションはダッシュボード上で別に表示される
RevenueCat ダッシュボードには Sandbox と Production の切り替えトグルがあります。
サンドボックスの購入は Sandbox ビューにのみ表示されます。
テストトランザクションがそこに表示されない場合は、SDK がレポートできていないか(API キー・configure 呼び出し・ネットワークを確認)、または RevenueCat のバックエンドに到達しない StoreKit 設定ファイル経由の購入である可能性があります。
サンドボックスでの更新サイクルの加速
サンドボックスでは、サブスクリプションの更新が加速されたテストクロックで実行されます。 これにより、数週間分の更新ロジックを数分で検証できます。
-
iOS サンドボックス更新サイクル(Apple のドキュメントより): 1日 → 3分、1週間 → 3分、1ヶ月 → 5分、2ヶ月 → 10分、3ヶ月 → 15分、6ヶ月 → 30分、1年 → 1時間。 サブスクリプションは最大 6 回自動更新された後に期限切れになります。
-
Android サンドボックス更新サイクルは Google Play Console → サブスクリプションのテスト に記載されています。 ライセンステスターのサブスクリプションも同じ加速クロックで更新されます。
初回購入フローには新しいテストユーザーを使用する
購入履歴はテストアカウント(サンドボックス Apple ID またはライセンステスターの Gmail)に紐付けられ、永続します。 すでに使用済みのアカウントで「初回購入」ロジック、イントロダクトリーオファー、または無料トライアルをテストすると、誤った結果になります。 クリーンな初回購入シナリオには、新しいサンドボックステスターアカウントを作成してください。
デバイスではなくダッシュボードで確認する
デバイス上で購入が成功したことと、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 による自動翻訳です。