benxu.AppPlatform.Billing.RevenueCat
3.0.4
dotnet add package benxu.AppPlatform.Billing.RevenueCat --version 3.0.4
NuGet\Install-Package benxu.AppPlatform.Billing.RevenueCat -Version 3.0.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="benxu.AppPlatform.Billing.RevenueCat" Version="3.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="benxu.AppPlatform.Billing.RevenueCat" Version="3.0.4" />
<PackageReference Include="benxu.AppPlatform.Billing.RevenueCat" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add benxu.AppPlatform.Billing.RevenueCat --version 3.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: benxu.AppPlatform.Billing.RevenueCat, 3.0.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package benxu.AppPlatform.Billing.RevenueCat@3.0.4
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=benxu.AppPlatform.Billing.RevenueCat&version=3.0.4
#tool nuget:?package=benxu.AppPlatform.Billing.RevenueCat&version=3.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
benxu.AppPlatform.Billing.RevenueCat
RevenueCat 訂閱服務整合套件,支援 Android / iOS 真實 SDK 與模擬測試模式。
功能
- ✅ 真實 RevenueCat SDK 整合(Android / iOS)
- ✅ 模擬模式(快速 UI 測試)
- ✅ Firestore 訂閱狀態同步
- ✅ Options Pattern 設定
安裝
dotnet add package benxu.AppPlatform.Billing.RevenueCat
快速開始
1. 設定 API Key
// MauiProgram.cs
builder.Services.AddRevenueCat(options =>
{
// 真實 SDK 模式
options.AppleApiKey = "appl_xxxxxxxxxx"; // iOS
options.GoogleApiKey = "goog_xxxxxxxxxx"; // Android
// 或使用 Test Store(開發測試)
// options.TestStoreApiKey = "test_xxxxxxxxxx";
// 權限設定
options.PremiumEntitlementId = "premium";
// Firestore 同步
options.SyncToFirestore = true;
options.FirestoreCollection = "subscriptions";
});
2. 初始化服務
// App.xaml.cs 或首次載入時
var subscription = serviceProvider.GetRequiredService<ISubscriptionService>();
await subscription.InitializeAsync(userId); // userId 可為 Firebase UID
3. 檢查訂閱狀態
@inject ISubscriptionService Subscription
@if (Subscription.IsSubscribed)
{
<PremiumContent />
}
else
{
<Paywall />
}
4. 購買訂閱
var result = await Subscription.PurchaseAsync("premium_monthly");
if (result.IsSuccess)
{
// 購買成功
}
else if (result.ErrorType == PurchaseErrorType.UserCancelled)
{
// 用戶取消
}
模擬模式
開發階段可啟用模擬模式,無需設定 RevenueCat:
builder.Services.AddRevenueCat(options =>
{
options.SimulatorMode = true;
options.Simulator.IsSubscribed = false; // 初始狀態
options.Simulator.Products = new()
{
new() { Id = "premium_monthly", Title = "月訂閱", PriceString = "NT$ 150" },
new() { Id = "premium_yearly", Title = "年訂閱", PriceString = "NT$ 1,490" }
};
});
本地端測試
請參考 Subscription_Implementation_Guide_zh-TW.md 的第 8 章「本地端測試指南」。
依賴套件
| 平台 | 套件 |
|---|---|
| Android | Xamarin.RevenueCat.Purchases |
| iOS | RevenueCat.Purchases |
相關文件
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-android36.0 is compatible. net10.0-ios26.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0-android36.0
- benxu.AppPlatform.Billing.Core (>= 3.0.4)
- benxu.AppPlatform.Firebase.Firestore (>= 3.0.4)
- Kebechet.Maui.RevenueCat.InAppBilling (>= 5.4.4)
- Microsoft.Maui.Controls (>= 10.0.0)
- Xamarin.AndroidX.Activity (>= 1.10.1.3)
- Xamarin.AndroidX.Activity.Ktx (>= 1.10.1.3)
- Xamarin.AndroidX.Collection (>= 1.5.0.3)
- Xamarin.AndroidX.Collection.Jvm (>= 1.5.0.3)
- Xamarin.AndroidX.Collection.Ktx (>= 1.5.0.3)
- Xamarin.Build.Download (>= 0.11.4)
-
net10.0-ios26.0
- benxu.AppPlatform.Billing.Core (>= 3.0.4)
- benxu.AppPlatform.Firebase.Firestore (>= 3.0.4)
- Kebechet.Maui.RevenueCat.InAppBilling (>= 5.4.4)
- Microsoft.Maui.Controls (>= 10.0.0)
- Xamarin.Build.Download (>= 0.11.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on benxu.AppPlatform.Billing.RevenueCat:
| Package | Downloads |
|---|---|
|
benxu.AppPlatform.MAUI.Bootstrap
Bootstrap package for benxu App Platform. Provides fluent API for one-line service registration and lifecycle management. |
GitHub repositories
This package is not used by any popular GitHub repositories.