mpesa-daraja-plugin-flutter-dart
dart wrapper for mpesa daraja api by safaricom
Features
- [Done]Lipa na mpesa [x]
- [inprogress] C2BSIMULATE
- [inprogress] B2B
- [inprogress] C2B
- [inprogress] B2C
- [inprogress] TRANSACTION STATUS
- [inprogress] ACCOUNT BALANCE
- [inprogress] REVERSAL
Getting started
You Will need a few things from Safaricom before development.
- Consumer Key
- Consumer Secret
- Test Credentials for Development/Sanbox environment
- Login or Register as a Safaricom developer here if you haven’t.
- Add a new App here
- You will be issued with a Consumer Key and Consumer Secret. You will use these to initiate an Mpesa Instance.
- Obtain Test Credentials here.
- The Test Credentials Obtained Are only valid in Sandbox/Development environment. Take note of them.
- To run in Production Environment you will need real Credentials.
- To go Live and be issued with real credentials,please refer to this guide
- Add dependancy in pubspec.yaml
Usage
Future<void> main() async {
final stk = MpesaDaraja(
consumerKey: 'Dm4oJgziMyOT7WTmJzQfEZS6jjzg1Frd',
consumerSecret: 'RGRvsUGkO4jc3NuW',
passKey: 'bfb279f9aa9bdbcf158e97dd71a467cd2e0c893059b10f78e6b72ada1ed2c919',
);
await stk.lipaNaMpesaStk(
"174379",
1,
"254798071520",
"174379",
"254798071520",
"https://mydomain.com/path",
"accountReference",
"transactionDesc",
);
}
Demo
- coming soon ….