No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Marcel van der Heide bc427bfb28
All checks were successful
Build Avalon.Billing / build (push) Successful in 10m28s
Build and push Avalon.Billing / build (push) Successful in 52s
feat: allow version range for deps
2026-08-14 18:13:18 +02:00
.forgejo/workflows feat: change workflow image 2026-08-07 12:46:20 +02:00
Avalon.Billing feat: allow version range for deps 2026-08-14 18:13:18 +02:00
Avalon.Billing.TestApp feat: initial working version + CI/CD workflows + TestApp 2026-08-05 12:38:12 +02:00
.gitignore feat: initial commit 2026-07-16 20:48:56 +02:00
Avalon.Billing.slnx feat: initial working version + CI/CD workflows + TestApp 2026-08-05 12:38:12 +02:00
LICENSE feat: initial commit 2026-07-16 20:48:56 +02:00
nuget.config feat: add nuget.config 2026-08-07 17:37:00 +02:00
README.md feat: initial working version + CI/CD workflows + TestApp 2026-08-05 12:38:12 +02:00

Avalon.Billing

A cross-platform billing service library for .NET Avalonia applications, providing a unified API for in-app purchases.

This library is derived from the .NET MAUI BillingService sample.

Features

  • Platform-agnostic billing interface (IBillingService)
  • Base implementation with common purchase tracking
  • Android billing integration using Google Play Billing Library
  • Product and purchase management
  • Purchase restoration support

Installation

dotnet add package Avalon.Billing

Usage

Basic Setup

// Register the service
builder.Services.AddSingleton<IBillingService, BillingService>();

// Initialize
await billingService.InitializeAsync();

Optional Android Configuration

var billingService = new BillingService
{
    UseAndroidActivityResolver = true
};

Product Retrieval

var products = await billingService.GetProductsAsync();
foreach (var product in products)
{
    Console.WriteLine($"{product.Name}: {product.Price} - Owned: {product.IsOwned}");
}

Making a Purchase

Subscribe to purchase confirmation events and initiate purchases:

// Subscribe to purchase confirmation events
billingService.PurchaseConfirmed += (productId) =>
{
    Console.WriteLine($"Purchase confirmed for {productId}");
};

// Initiate purchase
var result = await billingService.PurchaseAsync("your_product_id");
if (result.IsSuccess)
{
    Console.WriteLine("Purchase initiated successfully");
}
else
{
    Console.WriteLine($"Purchase initiation failed: {result.ErrorMessage}");
}

Checking Purchases

var purchased = await billingService.GetPurchasedProductsAsync();
foreach (var productId in purchased)
{
    Console.WriteLine($"Purchased: {productId}");
}

Restoring Purchases

await billingService.RestorePurchasesAsync();

License

This project is licensed under the MIT License. See LICENSE for details.