Paymentsds.Sdk.MPesaSdk 0.1.0

dotnet add package Paymentsds.Sdk.MPesaSdk --version 0.1.0                
NuGet\Install-Package Paymentsds.Sdk.MPesaSdk -Version 0.1.0                
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="Paymentsds.Sdk.MPesaSdk" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Paymentsds.Sdk.MPesaSdk --version 0.1.0                
#r "nuget: Paymentsds.Sdk.MPesaSdk, 0.1.0"                
#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.
// Install Paymentsds.Sdk.MPesaSdk as a Cake Addin
#addin nuget:?package=Paymentsds.Sdk.MPesaSdk&version=0.1.0

// Install Paymentsds.Sdk.MPesaSdk as a Cake Tool
#tool nuget:?package=Paymentsds.Sdk.MPesaSdk&version=0.1.0                

M-Pesa SDK for C#

M-Pesa SDK for C# is an unofficial library aiming to help developer businesses integrating every M-Pesa operations to their C# applications.

Features

  • Receive money from a mobile account to a business account
  • Send money from a business account to a mobile account
  • Send money from a business account to another business account
  • Revert a transaction
  • Query the status of a transaction

Usage

Receive Money from a Mobile Account

var client = new Client.Builder()
    .ApiKey("<REPLACE>")
    .PublicKey("<REPLACE>")
    .ServiceProviderCode("<REPLACE>")
    .InitiatorIdentifier("<REPLACE>")
    .Environment(Environment.Production)
    .Build();

var request = new Request.Builder()
    .Amount(10.0)
    .From("258841234567")
    .Reference("12345")
    .Transaction("12345")
    .Build();

//Async
    try
    {
        var response = await client.Receive(paymentRequest);
        if(response.IsSuccessfully) {
            //Handle Success Scenario
        }
    }
    catch (Exception e)
    {
        //Handle Exception Scenario
    }

Send Money to a Mobile Account

var client = new Client.Builder()
    .ApiKey("<REPLACE>")
    .PublicKey("<REPLACE>")
    .ServiceProviderCode("<REPLACE>")
    .InitiatorIdentifier("<REPLACE>")
    .Environment(Environment.Production)
    .Build();

var request = new Request.Builder()
    .Amount(10.0)
    .To("258841234567")
    .Reference("12345")
    .Transaction("12345")
    .Build();

//Async
    try
    {
        var response = await client.send(paymentRequest);
        if(response.IsSuccessfully) {
            //Handle Success Scenario
        }
    }
    catch (Exception e)
    {
        //Handle Exception Scenario
    } 
    

Send Money to a Business Account

var client = new Client.Builder()
    .ApiKey("<REPLACE>")
    .PublicKey("<REPLACE>")
    .ServiceProviderCode("<REPLACE>")
    .InitiatorIdentifier("<REPLACE>")
    .Environment(Environment.Production)
    .Build();

var request = new Request.Builder()
    .Amount(10.0)
    .To("54321")
    .Reference("12345")
    .Transaction("12345")
    .Build();

//Async
    try
    {
        var response = await client.send(paymentRequest);
        if(response.IsSuccessfully) {
            //Handle Success Scenario
        }
    }
    catch (Exception e)
    {
        //Handle Exception Scenario
    }

Revert a Transaction

var client = new Client.Builder()
    .ApiKey("<REPLACE>")
    .PublicKey("<REPLACE>")
    .ServiceProviderCode("<REPLACE>")
    .InitiatorIdentifier("<REPLACE>")
    .Environment(Environment.Production)
    .SecurityCredential("<REPLACE>")
    .Build();

var reversalRequest = new Request.Builder()
    .Amount(10.0)
    .Reference("12345")
    .Transaction("12345")
    .Build();

//Async
    try
    {
        var response = await client.revert(reversalRequest);
        if(response.IsSuccessfully) {
            //Handle Success Scenario
        }
    }
    catch (Exception e)
    {
        //Handle Exception Scenario
    }

Query the status of a Transaction

var client = new Client.Builder()
    .ApiKey("<REPLACE>")
    .PublicKey("<REPLACE>")
    .ServiceProviderCode("<REPLACE>")
    .Build();

var queryRequest = new Request.Builder()
    .Reference("12345")
    .Subject("12345")
    .Build();

//Async
    try
    {
        var response = await client.query(queryRequest);
        if(response.IsSuccessfully) {
            //Handle Success Scenario
        }
    }
    catch (Exception e)
    {
        //Handle Exception Scenario
    }

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 was computed.  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. 
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
0.1.0 691 9/28/2021