PHP code example of sdkcodes / lara-paystack

1. Go to this page and download the library: Download sdkcodes/lara-paystack 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/ */

    

sdkcodes / lara-paystack example snippets



//web.php
Route::post("/submit-payment-request", "PaymentController@initializeTransaction");

Route::get("/payment-callback", "PaymentController@respondToCallback");


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Sdkcodes\LaraPaystack\PaystackService;

class PaymentController{

    /**
    * Initiate bulk transfer and send money to multiple bank accounts at the same time
    */
    public function doMultipleTransfers(Request $request, PaystackService $paystack){
        
        // You can check this link for all fields that you can send to paystack https://developers.paystack.co/reference#initiate-bulk-transfer

        $people = array(
            [
                'amount' => 50000,
                'recipient' => 'RCP_m9yzgv4tbi6f20b'
            ],
            [
                'amount' => 20000,
                'recipient' => 'RCP_z6b9zeky5z379dn'
            ]
        );
        
        $response = $paystack->initiateBulkTransfer($people);
      
    }

}