public function submit($shortCode = null, $confirmationURL = null, $validationURL = null, $onTimeout = null, $account = null)
    {
        $account = $account ?: $this->account;

        if ($onTimeout) {
            $this->onTimeout($onTimeout);
        }

        $body = [
            'ShortCode'       => $shortCode ?: $this->shortCode,
            'ResponseType'    => $onTimeout ?: $this->onTimeout,
            'ConfirmationURL' => $confirmationURL ?: $this->confirmationURL,
            'ValidationURL'   => $validationURL ?: $this->validationURL
        ];

        try {
            $response = $this->makeRequest(
                $body,
                Core::instance()->getEndpoint(MPESA_REGISTER, $account),
                $account
            );

            return \json_decode($response->getBody());
        } catch (RequestException $exception) {
            $message = $exception->getResponse() ?
               $exception->getResponse()->getReasonPhrase() :
               $exception->getMessage();

            throw new Exception($message);
        }
    }
public function submit($shortCode = null, $confirmationURL = null, $validationURL = null, $onTimeout = null, $account = null)
    {
        $account = $account ?: $this->account;

        if ($onTimeout) {
            $this->onTimeout($onTimeout);
        }

        $body = [
            'ShortCode'       => $shortCode ?: $this->shortCode,
            'ResponseType'    => $onTimeout ?: $this->onTimeout,
            'ConfirmationURL' => $confirmationURL ?: $this->confirmationURL,
            'ValidationURL'   => $validationURL ?: $this->validationURL
        ];

        try {
            $response = $this->makeRequest(
                $body,
                Core::instance()->getEndpoint(MPESA_REGISTER, $account),
                $account
            );

            return \json_decode($response->getBody());
        } catch (RequestException $exception) {
            $message = $exception->getResponse() ?
               $exception->getResponse()->getReasonPhrase() :
               $exception->getMessage();

            throw new Exception($message);
        }
    }
public function submit ( $ shortCode = null , $ confirmationURL = null , $ validationURL = null , $ onTimeout = null , $ account = null ) { $ account = $ account ? : $ this -> account ; if ( $ onTimeout ) { $ this -> onTimeout ( $ onTimeout ) ; } $ body = [ 'ShortCode' => $ shortCode ? : $ this -> shortCode , 'ResponseType' => $ onTimeout ? : $ this -> onTimeout , 'ConfirmationURL' => $ confirmationURL ? : $ this -> confirmationURL , 'ValidationURL' => $ validationURL ? : $ this -> validationURL ] ; try { $ response = $ this -> makeRequest ( $ body , Core :: instance ( ) -> getEndpoint ( MPESA_REGISTER , $ account ) , $ account ) ; return \ json_decode ( $ response -> getBody ( ) ) ; } catch ( RequestException $ exception ) { $ message = $ exception -> getResponse ( ) ? $ exception -> getResponse ( ) -> getReasonPhrase ( ) : $ exception -> getMessage ( ) ; throw new Exception ( $ message ) ; } }
Initiate the registration process.

@param null $shortCode
@param null $confirmationURL
@param null $validationURL
@param null $onTimeout

@return mixed

@throws \Exception
Initiate the registration process .