PHP code example of barstec / laravel-paypal-payment-ipn

1. Go to this page and download the library: Download barstec/laravel-paypal-payment-ipn 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/ */

    

barstec / laravel-paypal-payment-ipn example snippets




namespace App\Http\Controllers;

use Barstec\Paypal\Payload;
use Barstec\Paypal\Payment;

class PaypalController extends Controller
{
    public function paypalTest(){
        $payload = new Payload();
        $payload->setBusinessEmail("[email protected]");
        $payload->setItemName("Testowe");
        $payload->setAmount(1);
        $payment = new Payment($payload);
        return $payment->redirect();
    }
}


protected $listen = [
    PaypalTransactionCreated::class => [
        ExampleListener::class
    ]
];

bash
php artisan vendor:publish --provider="Barstec\Paypal\PaypalServiceProvider"
bash
php artisan migrate