Paystack.NET.Client
1.0.1
See the version list below for details.
dotnet add package Paystack.NET.Client --version 1.0.1
NuGet\Install-Package Paystack.NET.Client -Version 1.0.1
<PackageReference Include="Paystack.NET.Client" Version="1.0.1" />
<PackageVersion Include="Paystack.NET.Client" Version="1.0.1" />
<PackageReference Include="Paystack.NET.Client" />
paket add Paystack.NET.Client --version 1.0.1
#r "nuget: Paystack.NET.Client, 1.0.1"
#:package Paystack.NET.Client@1.0.1
#addin nuget:?package=Paystack.NET.Client&version=1.0.1
#tool nuget:?package=Paystack.NET.Client&version=1.0.1
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 | 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. |
-
net6.0
- Newtonsoft.Json (>= 13.0.3)
-
net7.0
- Newtonsoft.Json (>= 13.0.3)
-
net8.0
- 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.