Aaio.SDK
0.0.2
dotnet add package Aaio.SDK --version 0.0.2
NuGet\Install-Package Aaio.SDK -Version 0.0.2
<PackageReference Include="Aaio.SDK" Version="0.0.2" />
<PackageVersion Include="Aaio.SDK" Version="0.0.2" />
<PackageReference Include="Aaio.SDK" />
paket add Aaio.SDK --version 0.0.2
#r "nuget: Aaio.SDK, 0.0.2"
#:package Aaio.SDK@0.0.2
#addin nuget:?package=Aaio.SDK&version=0.0.2
#tool nuget:?package=Aaio.SDK&version=0.0.2
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
Create a New Payment Link
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 | Versions 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. |
-
net9.0
- Microsoft.AspNetCore.WebUtilities (>= 9.0.3)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.