🛒revenuecat-customer-center
- プラグイン
- revenuecat
- ソース
- GitHub で見る ↗
説明
RevenueCatのカスタマーセンター(セルフサービス型のサブスクリプション管理UI)をアプリに追加します。 次のような場合に使用: - カスタマーセンターを追加したい - セルフサービス型のサブスクリプション画面を構築したい - アプリ内でユーザーがサブスクリプションを管理できるようにしたい - サブスクリプション管理画面を追加したい - `CustomerCenterView` を表示したい - `presentCustomerCenter` を呼び出したい - 「サブスクリプションを管理」ボタンをRevenueCatのカスタマーセンターに連携したい 対応プラットフォーム: iOS、Android、Kotlin Multiplatform、Flutter、React Native
原文を表示
Add the RevenueCat Customer Center (self service subscription management UI) to an app. Use when the user asks to add a customer center, build a self service subscriptions screen, let users manage subscriptions in app, add a subscription management screen, present CustomerCenterView, call presentCustomerCenter, or wire a 'manage subscription' button to the RevenueCat customer center on iOS, Android, Kotlin Multiplatform, Flutter, or React Native.
ユースケース
- ✓アプリにカスタマーセンターを追加したい
- ✓ユーザーが自分でサブスクリプション管理する
- ✓セルフサービス型の管理画面を構築したい
- ✓サブスクリプション管理ボタンを実装する
本文(日本語訳)
revenuecat-customer-center: RevenueCat Customer Center の追加
次のような場合に使用:
ユーザーが、カスタム UI を自前で実装することなく、既存の顧客がアクティブなサブスクリプションの管理・返金申請・キャンセル・購入履歴の復元・サポートへの連絡を行えるすぐに使える UI を必要としている場合。
この UI は RevenueCat ダッシュボードで設定し、RevenueCatUI SDK によってレンダリングされます。
前提条件: integrate-revenuecat スキルが実行済みであること。
Customer Center が顧客データを読み込むには、Purchases.configure(…) が成功している必要があります。
1. プラットフォームの検出
作業ディレクトリを確認し、以下の順番で最初に一致したものを採用してください。
- React Native:
package.jsonにreact-native-purchasesのエントリ、またはreact-nativeが依存関係として含まれている。Customer Center はreact-native-purchases-uiに含まれます。platforms/react-native.mdを参照。expoも依存関係にある場合は、Expo プロジェクトとして記録してください。 - Flutter: プロジェクトルートに
pubspec.yamlが存在する。Customer Center はpurchases_ui_flutterに含まれます。platforms/flutter.mdを参照。 - Kotlin Multiplatform:
build.gradle.ktsにkotlin { … }のマルチプラットフォームブロックがある、またはcom.revenuecat.purchases:purchases-kmp*に依存している。Customer Center の Composable はpurchases-kmp-uiに含まれます。platforms/kmp.mdを参照。 - Android(ネイティブ):
build.gradle(.kts)にcom.android.applicationが適用されている(KMP ではないもの)。Customer Center の Composable はcom.revenuecat.purchases:purchases-uiに含まれます。platforms/android.mdを参照。 - iOS(ネイティブ): プロジェクトルートに
Package.swift、*.xcodeproj、*.xcworkspace、またはPodfileが存在する。CustomerCenterViewはRevenueCatUIに含まれます。platforms/ios.mdを参照。
複数が一致する場合(例: Flutter プロジェクト内に ios/ フォルダが存在する場合)は、ビルドを管理している最も外側のプロジェクトを採用してください。
それでも判断できない場合は、どのプラットフォームを設定したいかユーザーに確認してください。
2. 共通の概念(全プラットフォーム共通)
-
Customer Center はダッシュボードで設定する UI です。 アクション、表示テキスト、プロモーションオファー、返金フロー、キャンセルアンケートの選択肢、サポートの連絡先などは、RevenueCat ダッシュボードの Customer Center セクションで定義します。 設定なしでは最小限のデフォルトレイアウトしかレンダリングされず、ユーザーにはほとんど有用な情報が表示されません。
-
意味のあるコンテンツを表示するには、購入履歴のある識別済みユーザーが必要です。 ユーザーが匿名で購入履歴がない場合、Customer Center は空の状態(または購入履歴の復元のみ)を表示します。 アプリがログインをサポートしている場合は、Customer Center を開く前に
Purchases.logIn(userId)を呼び出してください。 -
Customer Center はペイウォールとは別のものです。 一般的なパターンとして、設定画面に「サブスクリプションを管理」という項目を設け、そこから Customer Center を開くようにします。 ペイウォールは新規購入のため、Customer Center は既存のサブスクライバー向けのものです。
-
UI がフローを管理します。 購入履歴の復元・キャンセル・返金・プロモーションオファーのフローはコンポーネント内で完結します。 フローを制御するためではなく、アプリ側で反応するために、ライフサイクルコールバック(
onRestoreCompleted、onRefundRequestStarted、onManagementOptionSelected、onPromotionalOfferSucceededなど)をリッスンしてください。 -
プラットフォームによって対応状況が異なります。 Customer Center は iOS で最も早くサポートされ、その後 Android・KMP・Flutter・React Native が続きます。 対応していない機能はプラットフォームごとのファイルに記載されています。 返金申請は iOS 専用のアクションです(アプリ内返金申請を公開しているのは Apple のみ)。 Android では「サブスクリプションを管理」オプションが Google Play のサブスクリプション管理画面へのリンクになります。
-
**インストール済みの SDK バージョンが Customer Center をサポートしていない場合は、**手動のサブスクリプション管理画面で代替してください。具体的には、
Purchases.customerInfo()からユーザーのアクティブなエンタイトルメントを表示し、Purchases.restorePurchases()ボタンを設け、ストアのサブスクリプション管理 URL へのリンクを提供します。 Customer Center の完全な機能を利用したい場合は、SDK のアップグレードをユーザーに案内してください。
3. 実装
検出結果に対応するプラットフォームファイルを参照してください。
platforms/ios.mdplatforms/android.mdplatforms/kmp.mdplatforms/flutter.mdplatforms/react-native.md
各プラットフォームファイルは自己完結しており、インストールコマンド・Customer Center を表示するための具体的なコードスニペット・コールバックの形式が記載されています。
4. 動作確認
以下がすべて確認できるまで、統合完了と宣言しないでください。
- 対象プラットフォームでプロジェクトがビルドできること。
- 少なくとも 1 つのアクティブなサンドボックスサブスクリプションを持つテストユーザーでアプリにサインインし、Customer Center を開くコードパスを実行する。UI が読み込まれ、サブスクリプションが一覧に表示されること。
- 設定済みのアクションが少なくとも 1 つエンドツーエンドで動作すること。
最もシンプルな確認方法: 購入履歴を復元 をタップし、復元完了コールバックが
customerInfo.entitlements.activeに空でないマップを持って発火することを確認する。 ダッシュボードにキャンセル・返金・サポートのアクションが設定されている場合は、ユーザーがタップした際に対応するコールバック(onManagementOptionSelected、onRefundRequestStartedなど)が発火することを確認する。 - Customer Center を閉じると
onDismissコールバックが発火すること。
Customer Center は開くが内容が空の場合は、サインイン中のユーザーに購入履歴がないか、ダッシュボードの Customer Center セクションが設定されていません。 ダッシュボードで設定を修正し、リロードして再試行してください。
原文(English)を表示
revenuecat-customer-center: add the RevenueCat Customer Center
Use this skill when the user wants an out of the box UI that lets their customers manage active subscriptions, request refunds, cancel, restore, or contact support, without shipping custom UI. The UI is configured in the RevenueCat dashboard and rendered by the RevenueCatUI SDKs.
Prerequisite: integrate-revenuecat has already run. Purchases.configure(…) must succeed before the Customer Center can load customer data.
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. The Customer Center ships inreact-native-purchases-ui. Readplatforms/react-native.md. Ifexpois also a dependency, note it as an Expo project. - Flutter:
pubspec.yamlexists at the project root. The Customer Center ships inpurchases_ui_flutter. Readplatforms/flutter.md. - Kotlin Multiplatform:
build.gradle.ktshas akotlin { … }multiplatform block, or depends oncom.revenuecat.purchases:purchases-kmp*. The Customer Center composable is inpurchases-kmp-ui. Readplatforms/kmp.md. - Android (native):
build.gradle(.kts)appliescom.android.application(and is not KMP). The Customer Center composable is incom.revenuecat.purchases:purchases-ui. Readplatforms/android.md. - iOS (native):
Package.swift,*.xcodeproj,*.xcworkspace, orPodfileat the project root.CustomerCenterViewis inRevenueCatUI. 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)
- Customer Center is a dashboard configured UI. Actions, copy, promotional offers, refund flows, cancel survey options, and support contact details are defined in the RevenueCat dashboard under Customer Center. Without configuration, the view renders a minimal default layout; users will see almost nothing useful.
- It needs an identified user with purchases to surface anything meaningful. If the user is anonymous and has never bought anything, the Customer Center renders an empty / restore only state. If the app supports login, call
Purchases.logIn(userId)before opening the Customer Center. - Customer Center is separate from paywalls. The standard pattern: expose a "Manage subscription" row in the settings screen that opens the Customer Center. Paywalls are for new purchases; the Customer Center is for existing subscribers.
- The UI owns the flow. Restore, cancel, refund, and promotional offer flows run inside the component. Listen for the lifecycle callbacks (
onRestoreCompleted,onRefundRequestStarted,onManagementOptionSelected,onPromotionalOfferSucceeded, etc.) to react in app code, not to drive the flow. - Platform availability varies. iOS has had Customer Center longest; Android, KMP, Flutter, and React Native follow. Platform files flag any gaps. Refund requests are an iOS only action because only Apple exposes in app refund requests; on Android, the "Manage subscription" option links out to the Google Play subscriptions screen.
- If the installed SDK version is older than Customer Center support, the fallback is a manual subscription management screen: show the user's active entitlements from
Purchases.customerInfo(), expose aPurchases.restorePurchases()button, and link to the store's subscription management URL. Point the user to upgrade the SDK if they want the full Customer Center.
3. Implementation
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 to present the Customer Center, and the callback shape.
4. Verify
Do not claim the integration is complete until:
- The project builds on the target platform.
- Sign into the app with a test user that has at least one active sandbox subscription. Trigger the code path that opens the Customer Center. The UI loads and the subscription appears in the list.
- At least one configured action runs end to end. The simplest check: tap Restore purchases and confirm the restore completed callback fires with a non-empty
customerInfo.entitlements.activemap. If the dashboard has Cancel / Refund / Support actions configured, verify the corresponding callback (onManagementOptionSelected,onRefundRequestStarted, etc.) fires when the user taps through. - Dismissing the Customer Center fires the
onDismisscallback.
If the Customer Center opens but is empty, the signed in user has no purchases, or the dashboard Customer Center section is not configured. Fix in the dashboard, reload, and retry.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。