PHP code example of storewid / pesapal

1. Go to this page and download the library: Download storewid/pesapal library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

storewid / pesapal example snippets




namespace App\Http\Controllers;

use   Storewid\Pesapal;

use Illuminate\Http\Request;
class TransactionController extends Controller
{
//


    public function customer_makepayment(){


      $payment=new Pesapal($key, $secret, $endpoint, $currency, $callback,null);

     $response=$payment->processpayment($firstname, $lastname, $phone_number, $email, $amount, $description, $reference, $type = "MERCHANT");

   //response will be an iframe
    echo  $response;

    }