Mpesa class
Initializes a new instance of Mpesa Requires 4 parameters:
-
clientKey
- This is your consumer key -
clientSecret
- This is your consumer secret -
environment
- This is the environment our app is running on. It can either besandbox
orproduction
. -
initiatorPassword
- You can get this from Your Portal(production) or from test credentials(Sandbox). It will be the Security Credential (Shortcode 1)
Constructors
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
orproduction
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 thecallbackUrl
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