jkulubya / mtn-momo-dotnet

MTN Momo API in .NET
MIT License
2 stars 1 forks source link
csharp dotnet momoapi mtnmobilemoney

MTN Momo API for .NET

Build status

Use the MTN Mobile Money API in your .NET applications.

Currently targeting netstandard1.3.

Installation

Find the package on NuGet

Visual Studio Nuget Console

Install-Package MtnMomo.NET -IncludePrerelease

Dotnet CLI Tools

dotnet add package MtnMomo.NET --version 1.0.0-alpha-17

Usage

Collections

Documentation

using MtnMomo.NET;

var config = new MomoConfig();
config.UserId = UserId;
config.UserSecret = UserSecretKey;
config.SubscriptionKey = SubscriptionKey;

var collections = new CollectionsClient(config);

var result = await collections.RequestToPay(
    25000.00M,
    "UGX",
    "External ID",
    new Party("0777000000", PartyIdType.Msisdn),
    "Payer message",
    "Payee note",
    new Uri("http://www.example.com")
);

Disbursements

Documentation

using MtnMomo.NET;

var config = new MomoConfig();
config.UserId = UserId;
config.UserSecret = UserSecretKey;
config.SubscriptionKey = SubscriptionKey;

var disbursements = new DisbursementsClient(config);

var result = await disbursements.Transfer(
    25000.00M,
    "UGX",
    "External ID",
    new Party("0777000000", PartyIdType.Msisdn),
    "Payer message",
    "Payee message",
    new Uri("http://www.example.com")
);

Remittances

Documentation

using MtnMomo.NET;

var config = new MomoConfig();
config.UserId = UserId;
config.UserSecret = UserSecretKey;
config.SubscriptionKey = SubscriptionKey;

var remittances = new RemittancesClient(config);

var result = await remittances.Transfer(
    25000.00M,
    "UGX",
    "External Id",
    new Party("0777000000", PartyIdType.Msisdn),
    "Payer note",
    "Payee note",
    new Uri("http://www.example.com")
);