Paystack.NET.Client
1.0.4
dotnet add package Paystack.NET.Client --version 1.0.4
NuGet\Install-Package Paystack.NET.Client -Version 1.0.4
<PackageReference Include="Paystack.NET.Client" Version="1.0.4" />
<PackageVersion Include="Paystack.NET.Client" Version="1.0.4" />
<PackageReference Include="Paystack.NET.Client" />
paket add Paystack.NET.Client --version 1.0.4
#r "nuget: Paystack.NET.Client, 1.0.4"
#:package Paystack.NET.Client@1.0.4
#addin nuget:?package=Paystack.NET.Client&version=1.0.4
#tool nuget:?package=Paystack.NET.Client&version=1.0.4
Paystack.NET Client
Paystack.NET Client is a .NET package designed to provide seamless integration with the Paystack API. It is a portable class library that facilitates easy access to various Paystack services, enabling developers to effortlessly manage payments, transactions, and more within their .NET applications.
Whether you're building a payment gateway, managing transactions, or integrating with Paystack's rich feature set, Paystack.NET Client streamlines the process, saving you development time and effort.
Installation
Using the .NET Core command-line interface (CLI) tools:
dotnet add package Paystack.NET.Client
Using the NuGet Command Line Interface (CLI):
nuget install Paystack.NET.Client
Using the Package Manager Console:
Install-Package Paystack.NET.Client
From within Visual Studio:
- Open the Solution Explorer.
- Right-click on a project within your solution.
- Click on Manage NuGet Packages...
- Click on the Browse tab and search for "Paystack.NET".
- Click on the Paystack.NET package, select the appropriate version in the right-tab and click Install.
Documentation
For a comprehensive list of examples, check out the Examples Project.
Authentication
Paystack authenticates API requests using your account’s secret key, which you can find in the Paystack Dashboard (Settings > API Keys & Webhooks)
Use Configure method in PaystackConfiguration to set the Secret Key and the Base URL if needed.
PaystackConfiguration.Configure("sk_test_...");
Examples
Initialize a Transaction
using Paystack.NET.Configuration;
using Paystack.NET.Services.Transactions;
using Paystack.NET.Models.Transactions.Options;
PaystackConfiguration.Configure("sk_test_...");
var transactionService = new TransactionService();
var initializeOptions = new InitializeTransactionOptions
{
Reference = "TEST-" + DateTime.Now.ToString("yyyyMMddHHmmss");
Amount = 5000, // Amount in pesewas
Email = "customer@example.com"
};
var response = await transactionService.Initialize(initializeOptions);
Console.WriteLine($"Transaction Reference: {response.Data.Reference}");
Verify a Transaction
var reference = "TRANSACTION_REFERENCE_HERE";
var response = await transactionService.Verify(reference);
if (response.Data is { Status: TransactionStatus.Success })
{
Console.WriteLine("Transaction successful!");
}
Setup a Callback (Webhook)
using Paystack.NET.Services.Callback;
var requestBody = "{ ... }"; // Raw request body from Paystack webhook
var signatureHeader = "X-Paystack-Signature header from request";
var callbackService = new CallbackService();
try
{
var callback = callbackService.HandleCallback(requestBody, signatureHeader);
Console.WriteLine($"Event: {callback.Event}");
Console.WriteLine($"Data: {callback.Data}");
}
catch (UnauthorizedAccessException)
{
Console.WriteLine("Invalid webhook signature.");
}
Development
Contribution guidelines for this project
.NET 8 is required to build and test Paystack.NET SDK, you can install it from get.dot.net.
For any requests, bug or comments, please open an issue or submit a pull request.
| 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 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 is compatible. 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.4)
-
net10.0
- Newtonsoft.Json (>= 13.0.4)
-
net5.0
- Newtonsoft.Json (>= 13.0.4)
-
net6.0
- Newtonsoft.Json (>= 13.0.4)
-
net7.0
- Newtonsoft.Json (>= 13.0.4)
-
net8.0
- Newtonsoft.Json (>= 13.0.4)
-
net9.0
- Newtonsoft.Json (>= 13.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.