b2cTransaction method

Future<MpesaResponse> b2cTransaction({
  1. required String phoneNumber,
  2. required double amount,
  3. required String remarks,
  4. required String occassion,
  5. required String queueTimeOutURL,
  6. required String resultURL,
  7. BcCommandId commandID = BcCommandId.BusinessPayment,
})

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. phoneNumber This is the customer mobile number to receive the amount. - The number should have the country code (254) without the plus sign. amount The amount of money being sent to the customer. commandID This is a unique command that specifies B2C transaction type.(BusinessPayment, SalaryPayment, PromotionPayment) 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> b2cTransaction({
  required String phoneNumber,
  required double amount,
  required String remarks,
  required String occassion,
  required String queueTimeOutURL,
  required String resultURL,
  BcCommandId commandID = BcCommandId.BusinessPayment,
}) {
  var _bc = MpesaB2c(this,
      phoneNumber: phoneNumber,
      amount: amount,
      remarks: remarks,
      occassion: occassion,
      queueTimeOutURL: queueTimeOutURL,
      resultURL: resultURL,
      commandID: commandID);

  return _bc.process();
}