VOOZH about

URL: https://www.nuget.org/packages/benxu.AppPlatform.Billing.RevenueCat/

⇱ NuGet Gallery | benxu.AppPlatform.Billing.RevenueCat 3.2.7




benxu.AppPlatform.Billing.RevenueCat 3.2.7

dotnet add package benxu.AppPlatform.Billing.RevenueCat --version 3.2.7
 
 
NuGet\Install-Package benxu.AppPlatform.Billing.RevenueCat -Version 3.2.7
 
 
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.2.7" />
 
 
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.2.7" />
 
Directory.Packages.props
<PackageReference Include="benxu.AppPlatform.Billing.RevenueCat" />
 
Project file
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.2.7
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: benxu.AppPlatform.Billing.RevenueCat, 3.2.7"
 
 
#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.2.7
 
 
#: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.2.7
 
Install as a Cake Addin
#tool nuget:?package=benxu.AppPlatform.Billing.RevenueCat&version=3.2.7
 
Install as a Cake Tool
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";
 
 // 若未訂閱或訂閱失效,改刪除文件而非寫入 status = none
 options.DeleteInactiveStatusDocument = true;
});

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" }
 };
});

本地端測試

請參考 的第 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

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
Loading failed