Zakah is a client library for safaricom's Mpesa API.
Zakah is a client library for safaricom’s Mpesa API.
It’s name is derived from Kenyan hip hop artiste, Zakah.
It allows you to integrate with safaricom mpesa API.
It’s currently work in progress, API will remain unstable for sometime.
MPesa is a mobile phone-based money transfer, financing and microfinancing service, operated by Safaricom, the largest mobile network operator in Kenya. It has since expanded to other countries.
MPesa allows users to deposit, withdraw, transfer money and pay for goods and services easily with a mobile device. - https://en.wikipedia.org/wiki/M-Pesa
add the following to your pubspec.yaml
file;
dependencies:
zakah: <1.0.0
then run;
pub get
or with flutter;
flutter packages get
now, in your Dart code, you can use:
import 'package:zakah/zakah.dart';
this lib is also available at Pub package repository
import 'dart:async';
import 'package:zakah/zakah.dart' as zakah;
Future<void> main() async {
var m = new zakah.Mpesa('ConsumerKey', 'ConsumerSecret');
Map b2cResult = await m.b2c(
"apitest390",
"SecurityCredential",
zakah.CommandID["BusinessPayment"],
300,
"601390",
"254708374149",
"some remaks",
Uri.parse("https://www.google.com"),
Uri.parse("https://www.google.com"),
occasion: "some occasion");
print("final b2cResult::");
print(b2cResult);
}
dartfmt --overwrite --profile --follow-links .
pub run test .