Skip to content

Kotlin Multiplatform Library (Android, iOS, JVM & JS) for the Safaricom M-Pesa Daraja API 🔥

License

Notifications You must be signed in to change notification settings

jeffnyauke/mpesa-kmp-library

Repository files navigation

Build Kotlin GitHub License Maven Central badge-android badge-ios badge-mac badge-watchos badge-tvos badge-jvm badge-linux badge-windows badge-nodejs badge-browser

A Kotlin Multiplatform SDK for the Safaricom M-Pesa Daraja 2.0 API.

Supported features:

  • 🤳 Dynamic QR
  • 💶 STK Push - Lipa na M-Pesa Online API (M-PESA express)
  • ⏳ STK Push query
  • 📝 C2B register
  • 💶 C2B
  • 💶 B2C
  • ⏳ Transaction status
  • 🏦 Account balance
  • 🔁 Transaction reversal

At a glace

val mpesa = Mpesa("86smaD2TEnlXLVp9yOGvBiA9Znd3iHh3", "utbzOaE5a0LZFGB2")
val response = mpesa.stkPush(
    "174379",
    "bfb279f9aa9bdbcf158e97dd71a467cd2e0c893059b10f78e6b72ada1ed2c919",
    CustomerPayBillOnline,
    "1",
    "254708374149",
    "254708374149",
    "174379",
    "https://mydomain.com/path",
    "CompanyXLTD",
    "Payment of X",
)

Adding to your project

The library is available on Maven Central. Latest version Maven Central

Gradle

Add the Maven Central repository if it is not already there.

repositories { 
  mavenCentral()
}

To use the library in a single-platform project, add a dependency.

dependencies {
    implementation("io.github.jeffnyauke:mpesa:<version>")
}

In Kotlin Multiplatform projects, add the dependency to your commonMain source-set dependencies.

sourceSets {
  val commonMain by getting { 
    dependencies { 
      implementation("io.github.jeffnyauke:mpesa:<version>") 
    } 
  }
}

Contributing 🤝

Please feel free to open an issue if you have any questions or suggestions. Or participate in the discussion. If you want to contribute, please read the contribution guidelines for more information.

License 📃

mpesa-kmp-library is distributed under the terms of the Apache License (Version 2.0). See the license for more information.

Trademarks ™️

M-PESA is a trademark of Vodafone Group Plc. and is not affiliated with this project.

About

Kotlin Multiplatform Library (Android, iOS, JVM & JS) for the Safaricom M-Pesa Daraja API 🔥

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published