lipa_na_mpesa_online 0.9.91 copy "lipa_na_mpesa_online: ^0.9.91" to clipboard
lipa_na_mpesa_online: ^0.9.91 copied to clipboard

outdated

This is a dart mpesa daraja api from safaricom sandbox online payment. Written in pure dart for(ios, android, web and in plain native dart) and works.

lipa_na_mpesa_online #

A dart wrapper around mpesa daraja api from safaricom sandbox.

Ready Methods

  • LIPA NA MPESA ONLINE STK PUSH
  • C2BSIMULATE
  • B2B
  • C2B
  • B2C
  • TRANSACTION STATUS
  • ACCOUNT BALANCE
  • REVERSAL

Requisites #

You Will need a few things from Safaricom before development.

  1. Consumer Key
  2. Consumer Secret
  3. 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

Credits #

Contributors
kahdichienja

For help getting started with Flutter, view their online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Getting Started #

Add dependency in pubspec.yaml

dependencies:
  lipa_na_mpesa_online: [ADD_LATEST_VERSION_HERE]

Import in your Flutter app or plain dart app. in on pressed func, perform

lipanampesa(with all @requred params.)

//Now Support Production URLS
import 'package:lipa_na_mpesa_online/lipa_na_mpesa_online.dart';
import 'package:path/to/your/key.dart' as key;
MpesaService.lipanampesa(
  key.lipa_na_mpesa_passkey,
  key.business_short_code,
  key.consumer_key,
  key.consumer_secret,
  key.phone_number,
  key.transactiontype,
  key.amount,
  key.callbackURL,
  key.accountref,
  key.transactionDesc,
  apiCredintialURL: key.apiCredintialURL_prod,
  apiurlforstkpush: key.apiurlforstkpush_prod)
  .then(
    (value) => {
      //do what you want with the response from the .then(value)
      print('MerchantRequestID = '+value['MerchantRequestID']),
      print('CheckoutRequestID = '+value['CheckoutRequestID']),
      print('ResponseCode = '+value['ResponseCode']),
      print('ResponseDescription = '+value['ResponseDescription']),
      print('CustomerMessage = '+value['CustomerMessage'])
    },
  )

15
likes
40
pub points
30%
popularity

Publisher

unverified uploader

This is a dart mpesa daraja api from safaricom sandbox online payment. Written in pure dart for(ios, android, web and in plain native dart) and works.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter, http

More

Packages that depend on lipa_na_mpesa_online