ALATPay.NET
1.0.1
dotnet add package ALATPay.NET --version 1.0.1
NuGet\Install-Package ALATPay.NET -Version 1.0.1
<PackageReference Include="ALATPay.NET" Version="1.0.1" />
<PackageVersion Include="ALATPay.NET" Version="1.0.1" />
<PackageReference Include="ALATPay.NET" />
paket add ALATPay.NET --version 1.0.1
#r "nuget: ALATPay.NET, 1.0.1"
#:package ALATPay.NET@1.0.1
#addin nuget:?package=ALATPay.NET&version=1.0.1
#tool nuget:?package=ALATPay.NET&version=1.0.1
ALATPay.NET
Simplifying Payments, Empowering Businesses.
ALATPay.NET is a .NET library that simplifies integrating payment functionalities into your application. Designed for merchants and developers, it wraps the powerful ALATPay APIs, enabling seamless interactions with payment services like merchant onboarding, business management, and more.
Table of Contents
Features
- Merchant Onboarding: Manage merchant profiles.
- Business Management: Fetch, and track business information.
- Secure Transactions: Built-in mechanisms for secure API calls using subscription keys and support for seamless integration via the following channels.
- Pay via Bank Transfer
- Pay with Card
- Scalable Design: Supports various .NET target frameworks (e.g., .NET, .NET5.0, .NET 6.0, .NET 7.0, and .NET 8.0).
Installation
Install the ALATPay.NET NuGet package using the Package Manager Console or .NET CLI.
Package Manager Console:
Install-Package ALATPay.NET
The most important type in this library is the ALATPayClient class. You can create an instance of this class as follows:
var subscriptionKey = ConfigurationManager.AppSettings["SubscriptionKey"];
var api = new ALATPayClient(subscriptionKey, EnvironmentEnum.DEV);
Environment Configuration
The ALATPayClient constructor requires an EnvironmentEnum, which defines the environment in which the API operates:
public enum EnvironmentEnum
{
DEV,
SANDBOX,
PROD
}
Here are the test credentials for the dev environment:
- Business ID: 75a10b9d-5a94-43ef-71d7-08dcd7e2d6b4
- Transaction ID: 999cf73f-4b3c-4161-ae1c-4cf2f17da45e
- SubscriptionKey: a7589540b7374b7f8dee0e2ef7efdaad
- Merchant ID: 1ea91ec2-851e-47f1-ac6a-08dcd7e5dac5
Please see usage examples (and instructions) below:
Transactions API
To consume the Transactions API, use methods from the ITransactionsApi interface (available via the Transactions property of ALATPayClient, viz:
// Initializing a transaction
var response = api.Transactions.FetchTransaction(new Guid(999cf73f-4b3c-4161-ae1c-4cf2f17da45e));
if (response.Status)
// use response.Data
else
// show response.Message
The ITransactions is defined as follows:
public interface ITransactions
{
Task<ApiResponse<TransactionModel>> FetchTransaction(Guid id, CancellationToken cancellationToken = default);
Task<ApiResponse<CustomerListModel>> ListCustomers(Guid merchantId, Guid businessId, CancellationToken cancellationToken = default);
Task<ApiResponse<TransactionListModel>> ListTransactions(Guid merchantId, Guid userId, Guid businessId, decimal amount, DateTime startAt, DateTime endAt, int paymentMethodId = 0, string status = "All", string currency = "NGN", int page = 1, int offset = 10, CancellationToken cancellationToken = default);
}
Error Handling
All responses in ALATPay.NET are wrapped in the ApiResponse<T> class. Instead of throwing exceptions, the library follows a functional approach where errors are returned as part of the response. Users should always check the Status property before accessing the Data.
ApiResponse Definition:
public class ApiResponse<T>
{
[JsonProperty("data")]
public T Data { get; set; }
public bool Status { get; set; }
public string? Message { get; set; }
public int ErrorCode {get; set;}
}
Error Handling Example:
var response = api.Transactions.FetchTransaction(transactionId);
if (response.Status)
{
var transaction = response.Data;
// Process transaction
}
else
{
//Handle error as deem fit
Console.WriteLine($"Error: {response.Message}");
}
By following this approach, API consumers can handle errors gracefully without dealing with exceptions unless necessary.
Handling HTTP Errors
4xx Errors (Client Errors): These errors occur due to invalid requests, such as missing parameters or authentication failures.
The Message property will contain a relevant error message.
Status will be false, and Data will be null
Example:
var response = await api.SomeMethod(); if (!response.Status) { Console.WriteLine($"Client Error: {response.Message}"); }5xx Errors (Server Errors): These errors indicate issues on the server side
The Message property will contain a generic server error message.
Status will be false, and Data will be null.
Example:
var response = await api.SomeMethod(); if (!response.Status || response.ErrorCode == 500) { Console.WriteLine($"Server Error: {response.Message}"); }
Other APIs
Other APIs are implemented in like manner and exposed via the ALATPayClient type as given below:
// Bank Transfer APIs
var request = new GenerateVirtualAccountModel { ... };
var response = api.BanKTransfers.GenerateVirtualAccount(request);
// etc
Support
For inquiries or support, please contact support@alatpay.com
- Email: ALATPaysupport@Wemabank.com
- Website: ALATPay
- GitHub Issues: Please create an issue in this repository if you encounter any bugs.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 is compatible. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 3.1
- Newtonsoft.Json (>= 13.0.3)
- System.ComponentModel.Annotations (>= 5.0.0)
-
.NETStandard 2.1
- Newtonsoft.Json (>= 13.0.3)
- System.ComponentModel.Annotations (>= 5.0.0)
-
net5.0
- Newtonsoft.Json (>= 13.0.3)
- System.ComponentModel.Annotations (>= 5.0.0)
-
net6.0
- Newtonsoft.Json (>= 13.0.3)
- System.ComponentModel.Annotations (>= 5.0.0)
-
net7.0
- Newtonsoft.Json (>= 13.0.3)
- System.ComponentModel.Annotations (>= 5.0.0)
-
net8.0
- Newtonsoft.Json (>= 13.0.3)
- System.ComponentModel.Annotations (>= 5.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.