Avalon.Billing (0.1.0)
Installation
dotnet nuget add source --name Dutch --username your_username --password your_token dotnet add package --source Dutch --version 0.1.0 Avalon.BillingAbout this package
Avalon billing library. Currently only for Android.
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.
Dependencies
Details
2026-08-07 17:49:48 +02:00
Assets (2)
Versions (2)
View all
NuGet
2
Marcel van der Heide
17 KiB
avalon.billing.0.1.0.nupkg
16 KiB
avalon.billing.nuspec
1.2 KiB