src/Mpesa/B2C/Payment.php
/**
     * Initiate the B2C transaction.
     *
     * @return mixed
     */
Initiate the B2C transaction.
@return mixed
Initiate the B2C transaction . @return mixed
public function transact()
    {
        $paybill    = $this->engine->config->get('mpesa.paybill_number');
        $initiator  = $this->engine->config->get('mpesa.initiator');
        $credential = (new Generator($this->engine))->generate();
        $body       = [
            'InitiatorName'      => $initiator,
            'SecurityCredential' => $credential,
            'CommandID'          => 'BusinessPayment',
            'Amount'             => $this->amount,
            'PartyA'             => $paybill,
            'PartyB'             => $this->number,
            'Remarks'            => $this->details,
            'QueueTimeOutURL'    => $this->callback('mpesa.b2c_timeout_url'),
            'ResultURL'          => $this->callback('mpesa.b2c_result_url'),
        ];
        return $this->handleRequest($body);
    }
public function transact ( ) { $ paybill = $ this -> engine -> config -> get ( 'mpesa.paybill_number' ) ; $ initiator = $ this -> engine -> config -> get ( 'mpesa.initiator' ) ; $ credential = ( new Generator ( $ this -> engine ) ) -> generate ( ) ; $ body = [ 'InitiatorName' => $ initiator , 'SecurityCredential' => $ credential , 'CommandID' => 'BusinessPayment' , 'Amount' => $ this -> amount , 'PartyA' => $ paybill , 'PartyB' => $ this -> number , 'Remarks' => $ this -> details , 'QueueTimeOutURL' => $ this -> callback ( 'mpesa.b2c_timeout_url' ) , 'ResultURL' => $ this -> callback ( 'mpesa.b2c_result_url' ) , ] ; return $ this -> handleRequest ( $ body ) ; }
Initiate the B2C transaction.
Initiate the B2C transaction .