Paypal IPN callback stopped working in sandbox environment -


i'm having problem paypal ipn callback. paypal's ipn callback stopped working, in sandbox environment.

i've been testing client's website, past weeks, , has been working correctly - payment made, , callback ipn sent website, confirming payment, , updating website's database.

i haven´t change in code, , stopped working. payment still made , saved in paypal account, ipn retrying... doesn't complete.

here's code in use:

<?php  // step 1: read post data  // reading posted data directly $_post causes serialization issues array data in post. // instead, read raw post data input stream.  $raw_post_data = file_get_contents('php://input'); $raw_post_array = explode('&', $raw_post_data); $mypost = array(); foreach ($raw_post_array $keyval) { $keyval = explode ('=', $keyval); if (count($keyval) == 2) $mypost[$keyval[0]] = urldecode($keyval[1]); } // read ipn message sent paypal , prepend 'cmd=_notify-validate' $req = 'cmd=_notify-validate'; if(function_exists('get_magic_quotes_gpc')) { $get_magic_quotes_exists = true; }  foreach ($mypost $key => $value) {  if($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {  $value = urlencode(stripslashes($value));  } else { $value = urlencode($value); } $req .= "&$key=$value"; }  // step 2: post ipn data paypal validate  $ch = curl_init('https://www.sandbox.paypal.com/cgi-bin/webscr'); curl_setopt($ch, curlopt_http_version, curl_http_version_1_1); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_returntransfer,1); curl_setopt($ch, curlopt_postfields, $req); curl_setopt($ch, curlopt_ssl_verifypeer, 1); curl_setopt($ch, curlopt_ssl_verifyhost, 2); curl_setopt($ch, curlopt_forbid_reuse, 1); curl_setopt($ch, curlopt_httpheader, array('connection: close'));  // in wamp-like environments not come bundled root authority certificates, // please download 'cacert.pem' [link removed] , set  // directory path of certificate shown below: // curl_setopt($ch, curlopt_cainfo, dirname(__file__) . '/cacert.pem'); if( !($res = curl_exec($ch)) ) { // error_log("got " . curl_error($ch) . " when processing ipn data"); curl_close($ch); exit; } curl_close($ch);  ……  ?> 

firing outputs text files, discovered passes first step , stops on second, before

if( !($res = curl_exec($ch)) ) { 

i've submitted 3 requests paypal, still didn't answer them.

the curl request initiates http post paypal in order validate ipn message. if stops @ step, means do receive ipn post paypal, you've got problem connecting paypal.

what // error_log("got " . curl_error($ch) . " when processing ipn data"); contain?

in order resolve this, test https connection server following addresses:

for example, can run curl directly server (assuming you've got ssh access);

curl -v https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_notify-validate

this should return similar following:

$ curl -v https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_notify-validate * connect() www.sandbox.paypal.com port 443 (#0) *   trying 173.0.82.77... * connected * connected www.sandbox.paypal.com (173.0.82.77) port 443 (#0) * set certificate verify locations: *   cafile: /usr/ssl/certs/ca-bundle.crt   capath: none * sslv3, tls handshake, client hello (1): * sslv3, tls handshake, server hello (2): * sslv3, tls handshake, cert (11): * sslv3, tls handshake, server finished (14): * sslv3, tls handshake, client key exchange (16): * sslv3, tls change cipher, client hello (1): * sslv3, tls handshake, finished (20): * sslv3, tls change cipher, client hello (1): * sslv3, tls handshake, finished (20): * ssl connection using aes256-sha * server certificate: *        subject: 1.3.6.1.4.1.311.60.2.1.3=us; 1.3.6.1.4.1.311.60.2.1.2=delaware; businesscategory=private organization; serialnumber=3014267; c=us; postalcode=95131-2021; st=california; l=san jose; street=2211 n 1st st; o=paypal, inc.; ou=paypal production; cn=www.sandbox.paypal.com *        start date: 2011-09-01 00:00:00 gmt *        expire date: 2013-09-30 23:59:59 gmt *        common name: www.sandbox.paypal.com (matched) *        issuer: c=us; o=verisign, inc.; ou=verisign trust network; ou=terms of use @ https://www.verisign.com/rpa (c)06; cn=verisign class 3 extended validation ssl ca *        ssl certificate verify ok. > /cgi-bin/webscr?cmd=_notify-validate http/1.1 > user-agent: curl/7.28.1 > host: www.sandbox.paypal.com > accept: */* > * http 1.1 or later persistent connection, pipelining supported < http/1.1 200 ok < date: wed, 14 aug 2013 20:15:53 gmt < server: apache < x-frame-options: sameorigin < set-cookie: xxxxx     < x-cnection: close < set-cookie: xxxx domain=.paypal.com; path=/; secure; httponly < set-cookie: apache=10.72.128.11.1376511353229960; path=/; expires=fri, 07-aug-43 20:15:53 gmt < vary: accept-encoding < strict-transport-security: max-age=14400 < transfer-encoding: chunked < content-type: text/html; charset=utf-8 < * connection #0 host www.sandbox.paypal.com left intact **invalid* closing connection #0** * sslv3, tls alert, client hello (1): 

if receive timeout or ssl handshake error, need investigate separately.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -