b2bTransaction method

Future<MpesaResponse> b2bTransaction({
  1. required String shortCode,
  2. required IdentifierType identifierType,
  3. required double amount,
  4. required String remarks,
  5. String? accountReference,
  6. required String queueTimeOutURL,
  7. required String resultURL,
  8. required BbCommandId commandID,
})

The Business to Business (B2B) API is used to transfer money from one business to another business. shortCode This is the customer business number to receive the amount. amount The amount of money being sent to the customer. identifierType Type of organization receiving the transaction accountReference Any additional information to be associated with the transaction. Sentence of upto 100 characters commandID This is a unique command that specifies B2B transaction type. (BusinessPayBill, BusinessBuyGoods, DisburseFundsToBusiness, BusinessToBusinessTransfer, MerchantToMerchantTransfer) remarks Comments that are sent along with the transaction. Sentence of up to 100 characters queueTimeOutURL This is the URL to be specified in your request that will be used by API Proxy to send notification incase the payment request is timed out while awaiting processing in the queue. resultURL This is the URL to be specified in your request that will be used by M-PESA to send notification upon processing of the payment request.

Implementation

Future<MpesaResponse> b2bTransaction({
  required String shortCode,
  required IdentifierType identifierType,
  required double amount,
  required String remarks,
  String? accountReference,
  required String queueTimeOutURL,
  required String resultURL,
  required BbCommandId commandID,
}) {
  var _bb = MpesaB2B(this,
      shortCode: shortCode,
      identifierType: identifierType,
      amount: amount,
      remarks: remarks,
      accountReference: accountReference,
      queueTimeOutURL: queueTimeOutURL,
      resultURL: resultURL,
      commandID: commandID);

  return _bb.process();
}