dart_mpesa_advanced library

This library contains methods that make it easy to consume Mpesa Api. It's multi-platform, and supports CLI, server, mobile, desktop, and the browser.

Classes

Mpesa
MpesaB2B
The Business to Business (B2B) API is used to transfer money from one business to another business. This API enables the business to pay other businesses.
MpesaB2c
B2C API is an API used to make payments from a Business to Customers (Pay Outs). Also known as Bulk Disbursements. B2C API is used in several scenarios by businesses that require to either make Salary Payments, Cashback payments, Promotional Payments(e.g. betting winning payouts), winnings, financial institutions withdrawal of funds, loan disbursements etc.
MpesaC2BSimulation
Make payment requests from Client to Business (C2B). Simulate is available on sandbox only
MpesaResponse
MpesaService

Enums

ApplicationMode
BbCommandId
BbCommandId.BusinessPayBill This is a transfer of funds from one Organization's Working Account to another Organization's Utility Account. BbCommandId.BusinessBuyGoods A transfer of funds from one Organization's Working Account to another Organization's Merchant Account. BbCommandId.DisburseFundsToBusiness A transfer of funds from one Organization's Utility Account to another Organization's Working Account. BbCommandId.BusinessToBusinessTransfer A transfer of funds from one Organization's Working Account to another Organization's Working Account. BbCommandId.MerchantToMerchantTransfer A transfer of funds from one Organization's Merchant Account to another Organization's Merchant Account.
BcCommandId
BcCommandId.SalaryPayment This supports sending money to both registered BcCommandId.BusinessPayment BusinessPayment: This is a normal business to customer payment, supports only M-PESA registered customers. PromotionPayment PromotionPayment: This is a promotional payment to customers. The M-PESA notification message is a congratulatory message. Supports only M-PESA registered customers.
CbCommandID
CbCommandID.CustomerPayBillOnline This is used for Pay Bills shortcodes. CbCommandID.CustomerBuyGoodsOnline This is used for Buy Goods shortcodes.
IdentifierType

Functions

fetchMpesaToken(String username, String password, {ApplicationMode applicationMode = ApplicationMode.production}) Future<Map<String, dynamic>>
processMpesaTransaction(String url, Map<String, String> headers, Map<String, dynamic> payload) Future<MpesaResponse>

Exceptions / Errors

FetchTokenError