3
votes

I'm trying to get Paypal to redirect to my website after a transaction and retrieve information about the transaction. So far, Paypal does redirect to the correct location, but the php curl operation that I make back to Paypal afterwards retrieves an error page instead of the SUCCESS/FAIL message I'm expecting:

Sorry — your last action could not be completed

[...]

We are unable to complete your request at this time. Please click Retry or try again later. We apologize for the inconvenience.

Message 3004

I've tried simply having my code print the 'tx' parameter on screen, building my request manually and putting it directly in the browser, ie:

https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_notify-synch&tx=34A96012RS258972T&at=x7cYS4yOvBi2k_LuLWsJ3h_J-2n-29VCgzhFDR79on8s1mQSlSxIIibiW3e

But the same error page described above gets returned.

I'm logged in to my sandbox paypal account, and the 'at' parameter holds the correct payment data transfer identity token associated with my sandbox merchant test account.

Is my request missing anything? I haven't tested it with my actual Paypal account since I don't want any real money exchanges until I know it works.

2
looks like the sandbox is temporarily downuser557846
Have you contacted Paypal support?Bailey Parker
Having the same issue from at least last week. I contacted support and send them the details, hopefully they will give an answer tomorrowDmitry Dzygin
the "php" tag is not necessary, it doesn't what code makes POST request, I'm having the same problem on ASP.NETDmitry Dzygin

2 Answers

2
votes

same error here - noticed 2 weeks ago - have been in contact with paypal who told me to check my code - but even copied and pasted code sample still generates the error. When you log into the test seller account, can you see the transaction? I can but clicking the details view again generates the error.

I was able to pass through PDT on this account but then it suddenly started to fail with no change to my code.

UPDATED 31/07/2012: Still no confirmed resolution from Paypal - spoke to telephone support for merchants NOT technical team asthey apparently have no tech support by phone - was told by merchant advice basically to test live and avoid sandbox. A minimum 20p per test though as you'd have to refund your test transactions.

Not a very happy man I can tell you. :(

1
votes
$tx=$_REQUEST['tx'];

$paypal_url='https://www.paypal.com/cgi-bin/webscr?cmd=_notify-synch&tx='.$tx.'&at=token here';

$curl = curl_init($paypal_url);

$data = array(

"cmd" => "_notify-synch",

"tx" => $tx,

"at" => "token here"


);                                                                    

$data_string = json_encode($data); 

curl_setopt ($curl, CURLOPT_HEADER, 0);

curl_setopt ($curl, CURLOPT_POST, 1);

curl_setopt ($curl, CURLOPT_POSTFIELDS, $data_string);

curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0);

curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);

curl_setopt ($curl, CURLOPT_SSL_VERIFYHOST, 1);

$headers = array (

'Content-Type: application/x-www-form-urlencoded',

'Host: www.paypal.com',

'Connection: close'

);

curl_setopt ($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);

curl_setopt ($curl, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($curl);

$lines = explode("\n", $response);

$keyarray = array();

if (strcmp ($lines[0], "SUCCESS") == 0) {

for ($i=1; $i<count($lines);$i++){

list($key,$val) = explode("=", $lines[$i]);

$keyarray[urldecode($key)] = urldecode($val);

}


$first_name=$keyarray['first_name'];

$last_name=$keyarray['last_name'];

$payment_status=$keyarray['payment_status'];

$business=$keyarray['business'];

$payer_email=$keyarray['payer_email'];

$payment_gross=$keyarray['payment_gross'];

$mc_currency=$keyarray['mc_currency']; 

}