PHP code example of suchal / php-paypal-ipn

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

    

suchal / php-paypal-ipn example snippets



     $listener = new \wadeshuler\paypalipn\IpnListener();
    $listener->use_sandbox = true;

    if ($verified = $listener->processIpn())
    {
        // Valid IPN
        /*
            1. Check that $_POST['payment_status'] is "Completed"
            2. Check that $_POST['txn_id'] has not been previously processed
            3. Check that $_POST['receiver_email'] is your Primary PayPal email
            4. Check that $_POST['payment_amount'] and $_POST['payment_currency'] are correct
        */

    } else {

        // Invalid IPN

    }