![]() |
VOOZH | about |
dotnet add package benxu.AppPlatform.Billing.RevenueCat --version 3.2.7
NuGet\Install-Package benxu.AppPlatform.Billing.RevenueCat -Version 3.2.7
<PackageReference Include="benxu.AppPlatform.Billing.RevenueCat" Version="3.2.7" />
<PackageVersion Include="benxu.AppPlatform.Billing.RevenueCat" Version="3.2.7" />Directory.Packages.props
<PackageReference Include="benxu.AppPlatform.Billing.RevenueCat" />Project file
paket add benxu.AppPlatform.Billing.RevenueCat --version 3.2.7
#r "nuget: benxu.AppPlatform.Billing.RevenueCat, 3.2.7"
#:package benxu.AppPlatform.Billing.RevenueCat@3.2.7
#addin nuget:?package=benxu.AppPlatform.Billing.RevenueCat&version=3.2.7Install as a Cake Addin
#tool nuget:?package=benxu.AppPlatform.Billing.RevenueCat&version=3.2.7Install as a Cake Tool
RevenueCat 訂閱服務整合套件,支援 Android / iOS 真實 SDK 與模擬測試模式。
dotnet add package benxu.AppPlatform.Billing.RevenueCat
// 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";
// 若未訂閱或訂閱失效,改刪除文件而非寫入 status = none
options.DeleteInactiveStatusDocument = true;
});
// App.xaml.cs 或首次載入時
var subscription = serviceProvider.GetRequiredService<ISubscriptionService>();
await subscription.InitializeAsync(userId); // userId 可為 Firebase UID
@inject ISubscriptionService Subscription
@if (Subscription.IsSubscribed)
{
<PremiumContent />
}
else
{
<Paywall />
}
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" }
};
});
請參考 的第 8 章「本地端測試指南」。
| 平台 | 套件 |
|---|---|
| Android | Xamarin.RevenueCat.Purchases |
| iOS | RevenueCat.Purchases |
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0-android36.0 net10.0-android36.0 is compatible. net10.0-ios26.0 net10.0-ios26.0 is compatible. |
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. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.2.7 | 91 | 6/5/2026 |
| 3.2.6 | 114 | 5/30/2026 |
| 3.2.5 | 130 | 4/25/2026 |
| 3.2.4 | 99 | 4/25/2026 |
| 3.2.3 | 109 | 4/23/2026 |
| 3.2.2 | 110 | 4/22/2026 |
| 3.2.1 | 117 | 4/17/2026 |
| 3.2.0 | 110 | 4/11/2026 |
| 3.1.9 | 106 | 4/10/2026 |
| 3.1.8 | 100 | 4/10/2026 |
| 3.1.7 | 102 | 4/10/2026 |
| 3.1.6 | 106 | 4/10/2026 |
| 3.1.5 | 104 | 4/9/2026 |
| 3.1.4 | 99 | 4/7/2026 |
| 3.1.3 | 114 | 3/24/2026 |
| 3.1.2 | 106 | 3/23/2026 |
| 3.1.1 | 111 | 3/22/2026 |
| 3.1.0 | 105 | 3/22/2026 |
| 3.0.9 | 109 | 3/20/2026 |
| 3.0.8 | 103 | 3/19/2026 |