ipn_handler

class PaypalIPN { /** * @var bool $use_sandbox Indicates if the sandbox endpoint is used. */ /** @var bool Indicates if the sandbox endpoint is used. */ private $use_sandbox = false; /** * @var bool $use_local_certs Indicates if the local certificates are used. */ /** @var bool Indicates if the local certificates are used. */ private $use_local_certs = true; /** Production Postback URL */ const VERIFY_URI = 'https://ipnpb.paypal.com/cgi-bin/webscr'; /** Sandbox Postback URL */ const SANDBOX_VERIFY_URI = 'https://ipnpb.sandbox.paypal.com/cgi-bin/webscr'; /** Response from PayPal indicating validation was successful */ const VALID = 'VERIFIED'; /** Response from PayPal indicating validation failed */ const INVALID = 'INVALID'; /** * Sets the IPN verification to sandbox mode (for use when testing, * should not be enabled in production). @@ -44,9 +37,9 @@ public function usePHPCerts() $this->use_local_certs = false; } /** * Determine endpoint to post the verification data to. * * @return string */ public function getPaypalUri() @@ -58,7 +51,6 @@ public function getPaypalUri() } } /** * Verification Function * Sends the incoming post data back to PayPal using the cURL library. @@ -119,7 +111,10 @@ public function verifyIPN() } curl_setopt($ch, CURLOPT_FORBID_REUSE, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close')); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'User-Agent: PHP-IPN-Verification-Script', 'Connection: Close', )); $res = curl_exec($ch); if ( ! ($res)) { $errno = curl_errno($ch);

Pin It on Pinterest