Mpesa class

Initializes a new instance of Mpesa Requires 4 parameters:

  1. clientKey - This is your consumer key

  2. clientSecret - This is your consumer secret

  3. environment - This is the environment our app is running on. It can either be sandbox or production.

  4. initiatorPassword - You can get this from Your Portal(production) or from test credentials(Sandbox). It will be the Security Credential (Shortcode 1)

Constructors

Mpesa({required String clientKey, required String clientSecret, required String environment, required String passKey})
Initializes a new instance of Mpesa Requires 4 parameters:

Properties

clientKey String
Your consumer key
final
clientSecret String
Your consumer secret
final
environment String
Environment the app is running on. It can either be sandbox or production
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

lipaNaMpesa({required String phoneNumber, required double amount, required String callbackUrl, String? businessShortCode, String transactionType = "CustomerPayBillOnline", String accountReference = "account", String transactionDescription = "Lipa Na Mpesa Online"}) Future<MpesaResponse>
Triggers a lipa na mpesa stk push and presents user with dialog to input mpesa pin. The method will complete regardless of whether the transaction was successful or not. Results of the transaction are sent to the callbackUrl provided. Ensure that the callbackUrl provided is publicly accessible. You can use ngrok,localtunnel or serveo for local development.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited