PHP code example of fahim / laravel5-paypal-ipn

1. Go to this page and download the library: Download fahim/laravel5-paypal-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/ */

    

fahim / laravel5-paypal-ipn example snippets


use Fahim\PaypalIPN\PaypalIPNListener;

public function paypalIpn()
{
    $ipn = new PaypalIPNListener();
    $ipn->use_sandbox = true;

    $verified = $ipn->processIpn();

    $report = $ipn->getTextReport();

    Log::info("-----new payment-----");

    Log::info($report);

    if ($verified) {
        if ($_POST['address_status'] == 'confirmed') {
            // Check outh POST variable and insert your logic here
            Log::info("payment verified and inserted to db");
        }
    } else {
        Log::info("Some thing went wrong in the payment !");
    }
}

$listener = new IpnListener();
$listener->force_ssl_v3 = true;

$listener = new IpnListener();
$listener->follow_location = false;