Skip to content

This is the .Net wrapper for Paystack Payment API. It is a simple library that allows you to easily integrate Paystack's payment gateway into your application.

Notifications You must be signed in to change notification settings

GreatIdeasGH/GreatIdeasPaystackSDK

Repository files navigation

GreatIdeas.Paystack.SDK

License

What is it?

This is a .Net wrapper for Paystack RESTful API. It is a simple library that allows you to easily integrate Paystack's payment gateway into your application for African countries (Nigeria, Ghana, South Africa) and accepting international currencies (USD).

API Endpoints

Getting Started

This section will briefly guide you through the steps to get started with the library.

  1. Install the NuGet package
dotnet add package GreatIdeas.Paystack.SDK
  1. Add the Paystack dependency to your project. It is recommended to use the appsettings or other secret management to store your secret key.
// Using a web application
using GreatIdeas.Paystack.SDK;

var builder = WebApplication.CreateBuilder(args);

const string secretKey = "sk_test_xxx";

builder.Services
    .AddPaystack(secretKey);
    
// Using a console application
using GreatIdeas.Paystack.SDK;
using Microsoft.Extensions.Hosting;

const string secretKey = "sk_test_xxx";

var host = new HostBuilder()
    .ConfigureServices(services =>
    {
        services.AddPaystack(secretKey);
    })
    .Build();
    
  1. Usage of the library Transaction
...

private readonly IPaystackTransaction _paystackTransaction;

public Transaction(IPaystackTransaction paystackTransaction)
{
    _paystackTransaction = paystackTransaction;
}

public async Task<TransactionInitializeResponse> AcceptPayment(TransactionInitializeModel model,
        CancellationToken cancellationToken)
{
    var response = await _paystackTransaction.InitializeAsync(model, cancellationToken);
    return response!;
}
  

About

This is the .Net wrapper for Paystack Payment API. It is a simple library that allows you to easily integrate Paystack's payment gateway into your application.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages