RevenueCat.NET 1.0.1

Suggested Alternatives

RevenueCat.NET 2.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package RevenueCat.NET --version 1.0.1
                    
NuGet\Install-Package RevenueCat.NET -Version 1.0.1
                    
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="RevenueCat.NET" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RevenueCat.NET" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="RevenueCat.NET" />
                    
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 RevenueCat.NET --version 1.0.1
                    
#r "nuget: RevenueCat.NET, 1.0.1"
                    
#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 RevenueCat.NET@1.0.1
                    
#: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=RevenueCat.NET&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=RevenueCat.NET&version=1.0.1
                    
Install as a Cake Tool

, # RevenueCat.NET

NuGet License: MIT

A professional, production-ready .NET 8 client library for the RevenueCat REST API v2.

Features

  • Full API Coverage: Complete implementation of RevenueCat REST API v2
  • Modern .NET 8: Built with latest C# features (primary constructors, records, file-scoped namespaces)
  • SOLID Principles: Clean architecture with dependency injection support
  • Type-Safe: Strong typing with nullable reference types enabled
  • Async/Await: Fully asynchronous API with cancellation token support
  • Resilient: Built-in retry logic, rate limiting handling, and timeout management
  • Performance: Connection pooling, HTTP compression, and efficient JSON serialization
  • Extensible: Interface-based design for easy testing and mocking

Installation

dotnet add package RevenueCat.NET

Quick Start

using RevenueCat.NET;

var client = new RevenueCatClient("your_v2_api_key");

var projects = await client.Projects.ListAsync();

var customers = await client.Customers.ListAsync("proj_abc123");

var customer = await client.Customers.GetAsync(
    "proj_abc123", 
    "customer_id",
    expand: new[] { "attributes" }
);

Configuration

var client = new RevenueCatClient("your_api_key", options =>
{
    options.Timeout = TimeSpan.FromSeconds(60);
    options.MaxRetryAttempts = 5;
    options.RetryDelay = TimeSpan.FromSeconds(1);
    options.EnableRetryOnRateLimit = true;
});

Usage Examples

Projects

var projects = await client.Projects.ListAsync(limit: 20);

Apps

var apps = await client.Apps.ListAsync("proj_abc123");

var app = await client.Apps.CreateAsync("proj_abc123", new CreateAppRequest(
    Name: "My iOS App",
    Type: AppType.AppStore,
    AppStore: new AppStoreConfig(
        BundleId: "com.example.app",
        SharedSecret: "your_shared_secret"
    )
));

Customers

var customer = await client.Customers.CreateAsync("proj_abc123", new CreateCustomerRequest(
    Id: "user_12345",
    Attributes: new[]
    {
        new CustomerAttribute("$email", "user@example.com"),
        new CustomerAttribute("$displayName", "John Doe")
    }
));

await client.Customers.TransferAsync("proj_abc123", "old_customer_id", 
    new TransferCustomerRequest("new_customer_id"));

Products

var products = await client.Products.ListAsync(
    "proj_abc123",
    appId: "app_xyz789",
    expand: new[] { "items.app" }
);

var product = await client.Products.CreateAsync("proj_abc123", new CreateProductRequest(
    StoreIdentifier: "com.example.premium.monthly",
    AppId: "app_xyz789",
    Type: ProductType.Subscription,
    DisplayName: "Premium Monthly"
));

Entitlements

var entitlement = await client.Entitlements.CreateAsync("proj_abc123", 
    new CreateEntitlementRequest(
        LookupKey: "premium",
        DisplayName: "Premium Access"
    ));

await client.Entitlements.AttachProductsAsync("proj_abc123", "ent_abc123",
    new AttachProductsRequest(new[] { "prod_123", "prod_456" }));

Offerings & Packages

var offering = await client.Offerings.CreateAsync("proj_abc123",
    new CreateOfferingRequest(
        LookupKey: "default",
        DisplayName: "Default Offering",
        IsDefault: true
    ));

var package = await client.Packages.CreateAsync("proj_abc123", "offering_id",
    new CreatePackageRequest(
        LookupKey: "monthly",
        DisplayName: "Monthly Package",
        ProductId: "prod_123",
        Position: 1
    ));

Subscriptions

var subscriptions = await client.Subscriptions.ListAsync("proj_abc123", "customer_id");

await client.Subscriptions.CancelAsync("proj_abc123", "customer_id", "sub_id");

await client.Subscriptions.RefundAsync("proj_abc123", "customer_id", "sub_id");

Purchases

var purchases = await client.Purchases.ListAsync("proj_abc123", "customer_id");

await client.Purchases.RefundAsync("proj_abc123", "customer_id", "purchase_id");

Charts & Metrics

var metrics = await client.Charts.GetMetricsAsync(
    "proj_abc123",
    ChartMetricType.Revenue,
    startDate: 1704067200000, // Unix timestamp
    endDate: 1735689600000,
    appId: "app_123"
);

Error Handling

try
{
    var customer = await client.Customers.GetAsync("proj_abc123", "customer_id");
}
catch (NotFoundException ex)
{
    Console.WriteLine($"Customer not found: {ex.Message}");
}
catch (RateLimitException ex)
{
    Console.WriteLine($"Rate limited. Retry after: {ex.ErrorResponse?.BackoffMs}ms");
}
catch (RevenueCatException ex)
{
    Console.WriteLine($"API error: {ex.Message}");
    Console.WriteLine($"Error type: {ex.ErrorResponse?.Type}");
}

Dependency Injection

services.AddSingleton<IRevenueCatClient>(sp => 
    new RevenueCatClient("your_api_key"));

API Coverage

  • ✅ Projects
  • ✅ Apps (App Store, Play Store, Stripe, Amazon, Roku, Paddle, Web Billing)
  • ✅ Customers (with transfer support)
  • ✅ Products
  • ✅ Entitlements (with product attachment)
  • ✅ Offerings (with default offering support)
  • ✅ Packages
  • ✅ Paywalls
  • ✅ Subscriptions (with cancel/refund actions)
  • ✅ Purchases (with refund support)
  • ✅ Invoices
  • ✅ Charts & Metrics

Requirements

  • .NET 8.0 or higher
  • RevenueCat API v2 key

License

MIT License - see LICENSE file for details

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Author

frknlkn - GitHub

Support

For issues and questions:

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

See CHANGELOG.md for release notes