ALATPay.NET 1.0.1

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

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

Product 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. 
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
1.0.1 306 3/4/2025
1.0.0 202 12/12/2024