integrate-revenuecat
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseintegrate-revenuecat: end-to-end RevenueCat integration
integrate-revenuecat:端到端RevenueCat集成
Use this skill when the user wants to add RevenueCat to a project for the first time, or to reconfigure the SDK with a public API key. The skill covers two halves:
- Dashboard side — set up the project, register the app, and obtain the public API key, all through the RevenueCat MCP server.
- App side — install the Purchases SDK, call at app entry, and verify the configuration banner in the logs.
Purchases.configure(…)
Walk them in order. Most integrations need both halves, even when the user asks "just install the SDK" — the SDK needs an API key from the dashboard.
If a project + app already exist and the user only wants to wire the SDK into code, jump to Section 3 below. If the user wants to bootstrap a brand new RevenueCat project (apps + products + entitlements + offerings), use theskill instead, then come back here for the SDK install.create-revenuecat-project
当用户首次想要向项目中添加RevenueCat,或使用公开API密钥重新配置SDK时,可使用此技能。该技能涵盖两部分内容:
- 控制台端——通过RevenueCat MCP服务器完成项目设置、应用注册并获取公开API密钥。
- 应用端——安装Purchases SDK,在应用入口调用,并验证日志中的配置横幅。
Purchases.configure(…)
请按顺序执行这些步骤。大多数集成都需要完成这两部分,即使用户只要求“安装SDK”——因为SDK需要来自控制台的API密钥。
如果项目和应用已存在,且用户仅希望将SDK接入代码,请跳至下方的第3节。 如果用户想要搭建一个全新的RevenueCat项目(包含应用、产品、权益、产品套餐),请改用技能,之后再回到此处进行SDK安装。create-revenuecat-project
Arguments
参数
Available as when invoked as a slash command:
$ARGUMENTS- (optional): One of
platform,ios,android,kmp,flutter. If omitted, run the detection algorithm in Section 3a.react-native - (optional): Bundle ID (iOS) or package name (Android). If omitted, read it from the project files (
app_identifier,Info.plist,AndroidManifest.xml,app.json).pubspec.yaml - (optional): Name of the RevenueCat project to use. If omitted, list projects via MCP and ask the user.
project_name
通过斜杠命令调用时,可通过获取以下参数:
$ARGUMENTS- (可选):可选值为
platform、ios、android、kmp、flutter。若未指定,则执行第3a节中的检测算法。react-native - (可选):Bundle ID(iOS)或包名(Android)。若未指定,则从项目文件(
app_identifier、Info.plist、AndroidManifest.xml、app.json)中读取。pubspec.yaml - (可选):要使用的RevenueCat项目名称。若未指定,则通过MCP列出项目并询问用户。
project_name
1. Understand the status quo
1. 了解当前状态
Before touching the dashboard, gather the facts:
- Platform target: iOS / Apple App Store, Android / Google Play, or both. Inspect the working directory before asking — the detection algorithm in Section 3 makes this obvious for most projects.
- Technology: native iOS (Swift), native Android (Kotlin / Java), React Native, Flutter, Kotlin Multiplatform. SDK list: https://www.revenuecat.com/docs/getting-started/installation.md.
- App identifier: bundle ID (iOS), package name (Android). Pull from /
Info.plist/AndroidManifest.xml/app.jsonrather than asking.pubspec.yaml
操作控制台之前,请先收集以下信息:
- 目标平台:iOS/苹果应用商店、Android/Google Play,或两者皆有。操作前先检查工作目录——第3节中的检测算法可明确大多数项目的平台类型。
- 技术栈:原生iOS(Swift)、原生Android(Kotlin/Java)、React Native、Flutter、Kotlin Multiplatform。SDK列表:https://www.revenuecat.com/docs/getting-started/installation.md。
- 应用标识符:Bundle ID(iOS)、包名(Android)。优先从/
Info.plist/AndroidManifest.xml/app.json中获取,而非询问用户。pubspec.yaml
2. Dashboard side — RevenueCat MCP
2. 控制台端——RevenueCat MCP
Use the RevenueCat MCP server for every tool call below.
以下所有工具调用均需通过RevenueCat MCP服务器完成。
2a. Get or create the project
2a. 获取或创建项目
- — list accessible projects. If multiple, ask the user which one matches this app, or offer to create a new one.
list-projects - If there is no project, hand off to the skill, then resume here.
create-revenuecat-project - Store the for the rest of the steps.
project_id
- ——列出可访问的项目。若存在多个项目,请询问用户哪个项目与当前应用匹配,或提供创建新项目的选项。
list-projects - 若不存在项目,请转交至技能,之后再回到此处继续。
create-revenuecat-project - 保存用于后续步骤。
project_id
2b. Get or create the app
2b. 获取或创建应用
- Check which apps are already configured in the project. A app is always present;
test_storeandapp_storeapps are present only if the user has finished store-side setup.play_store - Ask the user whether their app is already set up in App Store Connect (iOS) or Google Play Console (Android). Reassure them that store-side setup can come later — the app is enough to start integrating.
test_store - If the user confirms store-side setup is done, call :
create-app- iOS: ,
type: "app_store"from Section 1.bundle_id - Android: ,
type: "play_store"from Section 1.package_name - derived from the identifier or asked from the user.
name
- iOS:
- 检查项目中已配置的应用。应用始终存在;
test_store和app_store应用仅在用户完成商店端设置后才会存在。play_store - 询问用户其应用是否已在App Store Connect(iOS)或Google Play Console(Android)中完成设置。请向用户保证,商店端设置可稍后进行——应用足以启动集成工作。
test_store - 若用户确认已完成商店端设置,请调用:
create-app- iOS:,
type: "app_store"来自第1节。bundle_id - Android:,
type: "play_store"来自第1节。package_name - 可从标识符推导或询问用户获取。
name
- iOS:
2c. Get the public API key
2c. 获取公开API密钥
- Call with the relevant app ID:
list-public-api-keys- /
app_storeif the store-side app exists.play_store - Otherwise the app.
test_store
- The returned key is public and safe to embed in client app code. iOS keys are prefixed , Android keys
appl_…, Amazongoog_….amzn_…
Never use the secret API key in client code. Secret keys are server-side only.
- 使用相关应用ID调用:
list-public-api-keys- 若存在商店端应用,则使用/
app_store。play_store - 否则使用应用。
test_store
- 若存在商店端应用,则使用
- 返回的密钥为公开密钥,可安全嵌入客户端应用代码中。iOS密钥前缀为,Android密钥前缀为
appl_…,亚马逊密钥前缀为goog_…。amzn_…
**切勿在客户端代码中使用私密API密钥。**私密密钥仅适用于服务端。
3. App side — install and configure the SDK
3. 应用端——安装并配置SDK
3a. Detect the platform
3a. 检测平台
Inspect the working directory and pick the first match, from top to bottom:
- React Native: has a
package.jsonentry, orreact-native-purchasesas a dependency → readreact-native. Ifplatforms/react-native.mdis also a dependency, note it as an Expo project.expo - Flutter: exists at the project root → read
pubspec.yaml.platforms/flutter.md - Kotlin Multiplatform: contains a
build.gradle.ktsmultiplatform source sets block, or depends onkotlin { … }→ readcom.revenuecat.purchases:purchases-kmp*.platforms/kmp.md - Android (native): applies
build.gradle(.kts)(and is not KMP) → readcom.android.application.platforms/android.md - iOS (native): ,
Package.swift,*.xcodeproj, or*.xcworkspaceat the project root → readPodfile.platforms/ios.md
If several match (e.g. an 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.
ios/检查工作目录,按从上到下的顺序选择第一个匹配项:
- 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)(且非KMP项目)→ 查看com.android.application。platforms/android.md - iOS(原生):项目根目录存在、
Package.swift、*.xcodeproj或*.xcworkspace→ 查看Podfile。platforms/ios.md
若存在多个匹配项(例如Flutter项目中包含文件夹),请选择最外层的项目,即负责构建的项目。若仍存在歧义,请询问用户要配置哪个平台。
ios/3b. Shared concepts (all platforms)
3b. 通用概念(所有平台)
- Public SDK key, not secret key. RevenueCat issues a separate public SDK key per store/platform. iOS apps use an key, Android apps use a
appl_…key (Amazon usesgoog_…). Server-side secret keys must never appear in client apps.amzn_… - Configure once per app launch. Call exactly once, as early as possible (app entry point). Later calls no-op or warn.
Purchases.configure(…) - Anonymous users by default. If you don't pass an , RevenueCat creates a stable anonymous ID. Only pass
appUserIDif you already have an authenticated user at launch; otherwise callappUserIDlater (see thelogIn(…)skill).revenuecat-identify-user - Enable debug logging during integration. Each platform file shows how. Turn it off for release builds.
- Keep keys out of source control. Recommend (RN),
.env(iOS),xcconfig/local.properties(Android), or dart-define (Flutter) when the user asks about secret management.gradle.properties
- **使用公开SDK密钥,而非私密密钥。**RevenueCat为每个商店/平台颁发独立的公开SDK密钥。iOS应用使用前缀的密钥,Android应用使用
appl_…前缀的密钥(亚马逊使用goog_…前缀)。服务端私密密钥绝不能出现在客户端应用中。amzn_… - **每次应用启动仅配置一次。**仅调用一次,且尽可能早地调用(应用入口点)。后续调用将无操作或发出警告。
Purchases.configure(…) - **默认使用匿名用户。**若未传入,RevenueCat将创建一个稳定的匿名ID。仅当启动时已存在已认证用户时才传入
appUserID;否则请稍后调用appUserID(详见logIn(…)技能)。revenuecat-identify-user - **集成期间启用调试日志。**各平台文件均说明了启用方式。发布版本需关闭调试日志。
- **避免密钥进入版本控制。**当用户询问密钥管理时,推荐使用(RN)、
.env(iOS)、xcconfig/local.properties(Android)或dart-define(Flutter)。gradle.properties
3c. Implementation
3c. 实现
Read the platform file that matches detection:
platforms/ios.mdplatforms/android.mdplatforms/kmp.mdplatforms/flutter.mdplatforms/react-native.md
Each platform file is self-contained: install command, exact snippet, and where to place it in the app entry point.
configure查看与检测结果匹配的平台文件:
platforms/ios.mdplatforms/android.mdplatforms/kmp.mdplatforms/flutter.mdplatforms/react-native.md
每个平台文件均为独立内容:包含安装命令、精确的代码片段,以及在应用入口点的放置位置。
configure4. Verify
4. 验证
Do not claim setup is complete until:
- The project builds (Xcode build, ,
./gradlew assembleDebug,flutter run, or the KMP equivalent).npx react-native run-ios - The app launches and the RevenueCat SDK logs a configuration banner in the console / logcat / Metro output (each platform file describes the expected log line).
- No authentication errors appear on the first SDK network call. A wrong API key surfaces as an auth error log as soon as the app fetches offerings.
If the user only asked to "install" without running the app, tell them what to look for in the logs when they do run it.
满足以下条件后,方可确认设置完成:
- 项目可构建(Xcode构建、、
./gradlew assembleDebug、flutter run或KMP对应的构建命令)。npx react-native run-ios - 应用启动后,RevenueCat SDK在控制台/logcat/Metro输出中打印配置横幅(各平台文件均描述了预期的日志行)。
- 首次SDK网络调用未出现认证错误。若API密钥错误,应用获取产品套餐时会立即在日志中显示认证错误。
若用户仅要求“安装”而未运行应用,请告知其运行应用时需在日志中查看的内容。
5. Next steps
5. 后续步骤
5a. Products, entitlements, offerings
5a. 产品、权益、产品套餐
Check whether products, entitlements, and offerings are already set up in the project. If not, offer to help via the skill.
create-revenuecat-project检查项目中是否已设置产品、权益和产品套餐。若未设置,可提供技能协助完成。
create-revenuecat-project5b. Store-side setup
5b. 商店端设置
iOS (App Store Connect)
- In-App Purchase Key (recommended for StoreKit 2) — App Store Connect → Users and Access → Integrations → In-App Purchase. Generate key, download the file. Note the Key ID and Issuer ID.
.p8 - Shared Secret (legacy StoreKit 1) — App Store Connect → App → App Information → App-Specific Shared Secret.
- If the user provides this information, register it on the RevenueCat side via /
create-app.update-app
Android (Google Play Console)
- Service account credentials — Create a service account in Google Cloud Console. Grant "Service Account User" role. Create a JSON key. In Play Console, grant the service account access with "View financial data" permission.
- Real-time Developer Notifications (RTDN) — Set up a Cloud Pub/Sub topic. Configure in Play Console → Monetization setup.
- If the user provides this information, register it via /
create-app.update-app
iOS(App Store Connect)
- 内购密钥(推荐用于StoreKit 2)——App Store Connect → 用户与访问 → 集成 → 内购。生成密钥,下载文件。记录密钥ID和发行者ID。
.p8 - 共享密钥(旧版StoreKit 1)——App Store Connect → 应用 → 应用信息 → 应用专属共享密钥。
- 若用户提供上述信息,请通过/
create-app在RevenueCat端完成注册。update-app
Android(Google Play Console)
- 服务账号凭据——在Google Cloud Console中创建服务账号。授予“服务账号用户”角色。创建JSON密钥。在Play Console中,为该服务账号授予“查看财务数据”权限。
- 实时开发者通知(RTDN)——设置Cloud Pub/Sub主题。在Play Console → 变现设置中完成配置。
- 若用户提供上述信息,请通过/
create-app完成注册。update-app
5c. Subsequent skills
5c. 后续技能
Common follow-ups after :
integrate-revenuecat- — display a dashboard-configured paywall.
revenuecat-paywall - — implement purchase + restore manually.
revenuecat-purchase-flow - — gate features behind active entitlements.
revenuecat-entitlements-gate - — wire
revenuecat-identify-user/logInto the app's auth system.logOut - — set up a sandbox testing channel.
revenuecat-testing-setup - — diagnose offerings / products / entitlement bugs.
revenuecat-troubleshoot
integrate-revenuecat- ——展示控制台配置的付费墙。
revenuecat-paywall - ——手动实现购买+恢复流程。
revenuecat-purchase-flow - ——通过有效权益限制功能访问。
revenuecat-entitlements-gate - ——将
revenuecat-identify-user/logIn接入应用的认证系统。logOut - ——搭建沙盒测试渠道。
revenuecat-testing-setup - ——诊断产品套餐/产品/权益相关问题。
revenuecat-troubleshoot