Aaio.SDK 0.0.2

dotnet add package Aaio.SDK --version 0.0.2
                    
NuGet\Install-Package Aaio.SDK -Version 0.0.2
                    
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="Aaio.SDK" Version="0.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aaio.SDK" Version="0.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Aaio.SDK" />
                    
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 Aaio.SDK --version 0.0.2
                    
#r "nuget: Aaio.SDK, 0.0.2"
                    
#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 Aaio.SDK@0.0.2
                    
#: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=Aaio.SDK&version=0.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Aaio.SDK&version=0.0.2
                    
Install as a Cake Tool

SDK for the aaio.so API (Payment System)

Creating a Client with a Cart

var aaio = new AaioClient("api key");
var merchant = aaio.CreateMerchant("Merchant ID", "Secret 1");

General Information

Get Payment Methods

var paymentMethods = await merchant.GetPaymentMethodsAsync();

Get AAIO Server IP Addresses

var ips = await aaio.GetIpsAsync();

Creating a Payment

var orderId = Guid.NewGuid().ToString();

var paymentUrl = merchant.CreatePayment(new() {
    amount = 100,                          
    orderId = orderId,                     
    description = "My order description",  
    method = "qiwi",                       
    email = "support@email.com",                  
    referral = "123456",             
    currency = "USD",                      
    language = "en"                        
});

Console.WriteLine(paymentUrl);

Waiting for a Payment Event

To wait for a payment event, you can run a waiter:

merchant.waiter.AddWaiter(orderId,
    success: (orderId, info) => {
        Console.WriteLine($"Payment {orderId} success");
    },
    error: (orderId, error) => {
        Console.WriteLine($"Payment {orderId} error: {error}");
    }
);

By default, the waiter will wait for 3 days, requesting the status starting from the first second and doubling the interval each time. You can change the settings:

merchant.waiter.timeout = TimeSpan.FromDays(3);
merchant.waiter.startDelay = TimeSpan.FromSeconds(1);
merchant.waiter.maxDelay = TimeSpan.FromMinutes(5);

Handling Server Restarts or Failures

If your server restarts or crashes, you need to store all created orders somewhere. You can also use the Startup() method!

Let's imagine you have a database with all orders. As soon as you create a new order using CreatePayment(), you place it in the database with a status of "process". Remember to update the status when an error occurs or it is successfully completed.

Here is how it might look, place this code at the start of your application:

merchant.waiter.outsideSuccess += PaymentWaiterSuccess;
merchant.waiter.outsideError += PaymentWaiterError;

using (var context = databaseFactory.Context()) {

    // Finding all orders in the DB that are still being processed
    var processPayments = context.paymentTable
        .Where(x => x.status == PaymentStatus.process)
        .Select(x => x.id)
        .ToList();

    // Startup() calls AddWaiter() for each ID with a reference to outsideSuccess and outsideError
    merchant.waiter.Startup(
        orderIds: processPayments.Select(x => x.ToString()),
        runScatter: TimeSpan.FromMinutes(1) // The runScatter parameter allows you to launch server requests in random order
    );
}

Account Methods

Get Balance

var balances = await aaio.GetBalancesAsync();

Get Payoff Methods

var payoffMethods = await aaio.GetPayoffMethodsAsync();

Get Payoff Rates

var payoffRates = await aaio.GetPayoffRatesAsync();

Get Available SBP Banks for Payoff

var payoffSbpBanks = await aaio.GetPayoffSbpBanksAsync();

Creating a Payoff

var payoff = await aaio.CreatePayoffAsync(
    method: "method",
    amount: 100,
    wallet: "wallet",
    payoffId: "payoffId", 
    commissionType: 0
);

Get Payoff Status

var payoffStatus = await aaio.GetPayoffInfoAsync(payoff.id, "aaioId");

Validate Payoff

var payoffStatus = await aaio.IsValidPayoff(payoffWebhookData, secretKeyPayoff);
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.

Version Downloads Last Updated
0.0.2 233 5/12/2025
0.0.1 223 5/12/2025