public static function ipn()
        {
            // only accept post data
            if (!count($_POST)) {
                return false;
            }

            // if production mode...
            if (Config::get('paypal.production_mode')) {
                // use production endpoint
                $endpoint = 'https://www.paypal.com/cgi-bin/webscr';
            } else {
                // use sandbox endpoint
                $endpoint = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
            }

            // build response
            $fields = http_build_query(array('cmd' => '_notify-validate') + Input::all());

            // curl request
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $endpoint);
            curl_setopt($ch, CURLOPT_TIMEOUT, 30);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
            $response = curl_exec($ch);
            $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);

            // if errors...
            if (curl_errno($ch)) {
                #$errors = curl_error($ch);
                curl_close($ch);

                // return false
                return false;
            } else {
                // close connection
                curl_close($ch);

                // if success...
                if ($code === 200 and $response === 'VERIFIED') {
                    return true;
                } else {
                    return false;
                }
            }
        }
public static function ipn()
        {
            // only accept post data
            if (!count($_POST)) {
                return false;
            }

            // if production mode...
            if (Config::get('paypal.production_mode')) {
                // use production endpoint
                $endpoint = 'https://www.paypal.com/cgi-bin/webscr';
            } else {
                // use sandbox endpoint
                $endpoint = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
            }

            // build response
            $fields = http_build_query(array('cmd' => '_notify-validate') + Input::all());

            // curl request
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $endpoint);
            curl_setopt($ch, CURLOPT_TIMEOUT, 30);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
            $response = curl_exec($ch);
            $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);

            // if errors...
            if (curl_errno($ch)) {
                #$errors = curl_error($ch);
                curl_close($ch);

                // return false
                return false;
            } else {
                // close connection
                curl_close($ch);

                // if success...
                if ($code === 200 and $response === 'VERIFIED') {
                    return true;
                } else {
                    return false;
                }
            }
        }
public static function ipn ( ) { // only accept post data if ( ! count ( $ _POST ) ) { return false ; } // if production mode... if ( Config :: get ( 'paypal.production_mode' ) ) { // use production endpoint $ endpoint = 'https://www.paypal.com/cgi-bin/webscr' ; } else { // use sandbox endpoint $ endpoint = 'https://www.sandbox.paypal.com/cgi-bin/webscr' ; } // build response $ fields = http_build_query ( array ( 'cmd' => '_notify-validate' ) + Input :: all ( ) ) ; // curl request $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ endpoint ) ; curl_setopt ( $ ch , CURLOPT_TIMEOUT , 30 ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYHOST , 2 ) ; curl_setopt ( $ ch , CURLOPT_SSL_VERIFYPEER , true ) ; curl_setopt ( $ ch , CURLOPT_POST , true ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , $ fields ) ; $ response = curl_exec ( $ ch ) ; $ code = curl_getinfo ( $ ch , CURLINFO_HTTP_CODE ) ; // if errors... if ( curl_errno ( $ ch ) ) { #$errors = curl_error($ch); curl_close ( $ ch ) ; // return false return false ; } else { // close connection curl_close ( $ ch ) ; // if success... if ( $ code === 200 and $ response === 'VERIFIED' ) { return true ; } else { return false ; } } }
Automatically verify Paypal IPN communications.

@return  boolean
Automatically verify Paypal IPN communications .