GitHub 저장소newtonmunene99/mpesa-dart

mpesa-dart

mpesa daraja api에 대한 dart 래퍼

mpesa-dart 프로젝트 이미지
스타
21
포크
15
최근 푸시(UTC)
2023. 7. 6.
프로젝트 상태
활성

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

mpesa

A dart wrapper around mpesa daraja api.

Ready Methods/APIs

  • [x] LIPA NA MPESA
  • [ ] 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

Getting Started

Add dependency in pubspec.yaml

dependencies:
  mpesa: [ADD_LATEST_VERSION_HERE]

Import in your Flutter app or plain dart app.

import 'package:mpesa/mpesa.dart';

class MYClass {

    Mpesa mpesa = Mpesa(
        clientKey: "YOUR_CONSUMER_KEY_HERE",
        clientSecret: "YOUR_CONSUMER_SECRET_HERE",
        passKey: "YOUR_LNM_PASS_KEY_HERE",
        environment: "sandbox",
    );

}

Environment should be either sandbox or production

Methods and Api Calls

Lipa Na Mpesa Online (LNMO)

Lipa na M-Pesa Online Payment API is used to initiate a M-Pesa transaction on behalf of a customer using STK Push. This is the same technique mySafaricom App uses whenever the app is used to make payments.

import 'package:mpesa/mpesa.dart';

class MYClass {

    myMethod(){
        mpesa
            .lipaNaMpesa(
                phoneNumber: "",
                amount: 1,
                businessShortCode: "",
                callbackUrl: "",
            )
            .then((result) {})
            .catchError((error) {});
    }
}
  1. businessShortCode - The organization shortcode used to receive the transaction.
  2. amount - The amount to be transacted.
  3. phoneNumber - The MSISDN sending the funds.
  4. callbackUrl - The url to where responses from M-Pesa will be sent to.

Features and bugs

Please file feature requests and bugs at the issue tracker.

Recording

Recording

Demo App

Demo App

Contributing

  1. Fork the project then clone the forked project
  2. Create your feature branch: git checkout -b my-new-feature
  3. Make your changes and add name to Contributors list below and in authors in pubspec.yaml
  4. Commit your changes: git commit -m 'Add some feature'
  5. Push to the branch: git push origin my-new-feature
  6. Submit a pull request.

Credits

| Contributors |

Kevin Oduor
Newton Munene

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

Newton Munene GitHub avatar
GitHub 작성자

Newton Munene ↗

The Variable Man

@themindleproject Nairobi,Kenya공식 웹사이트 ↗
언어Dart

분류

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 3 개

  • http^0.13.3
  • lint개발 의존성^1.5.3
  • test개발 의존성^1.17.4

프로젝트에 맞는 저장소를 선택하려면?

사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.

  1. 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
  2. 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
  3. 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.

출처 및 관리

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗