Giter VIP home page Giter VIP logo

mpesasdk.net's Introduction

MpesaSDK.NET

Mpesa Daraja SDK implementation for .net.

Build Status Nuget Nuget

For More Info check Safaricom Mpesa Documentation

Download and Install

nugget install

Usage

Sending Requests


Mpesa Client
using MpesaSDK.NET;
using MpesaSDK.NET.Dtos.Requests;
...
//Development
MpesaClient mpesaclient = new MpesaClient("consumerkey", "secret");

//Production
MpesaClient mpesaclient = new MpesaClient("consumerkey", "secret", sandbox:false);
STK Push request
var result = await mpesaclient.STKPushAsync(...);
Stk Push Query request
var result = await mpesaclient.StkPushQueryAsync(...);
B2C request
var result = await mpesaclient.B2CAsync(...);
B2B request
var result = await mpesaclient.B2BAsync(...);

To get MPesa Security credetials for both B2B and B2C use method below.

string credential = "pass".ToMpesaSecurityCredential(); 
C2B Register Url request
var result = await mpesaclient.C2BRegisterUrlAsync(...);
C2B Simulate Transaction request
var result = await mpesaclient.C2BSimulateTransactionAsync(...);
Account Balance request
var result = await mpesaclient.AccountBalanceAsync(...);
Transaction Status request
var result = await mpesaclient.TransactionStatusAsync(...);
Reversal request
var result = await mpesaclient.ReversalAsync(...);

Callback server


Check sample callback api here

Docs to be updated soon.

LICENSE

Apache LICENSE-2.0 read more

mpesasdk.net's People

Contributors

cindro avatar dependabot[bot] avatar mbithy avatar mutiadavid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

mpesasdk.net's Issues

What is a passKey?

On the docs there is no where Safaricom mentions a passKey. The only keys you have are

  • initiator
  • Security credential
  • LNMpassword

Which of the three does your parameter "passKey" refer to on the method STKPushAsync?

Business Short Code Length

in the beginning it used to be 5 and 6 but now we have paybills with at least 7. Kindly update your validator to be >5

Concrete code examples

Beautiful Library but misses code examples E.g.

            var result = await mpesaclient.STKPushAsync("44444", "254722600601", 10, "passkey", "https://urdomain.ext/path", accountReference: "1234567890", transactionDesc: "Goods payment");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.