问题
So, I've created a sandbox transaction and am trying to get the data for it on my thank you page.
<?php
$tx = $_REQUEST['tx'];
$pdti = "REDACTED";
$url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
$data = array("tx" => $tx, "at" => $pdti,"cmd" => "_notify-synch");
$options = array(
"http" => array(
"header" => "Content-type: application/x-www-form-urlencoded\r\n",
"method" => "POST",
"content" => http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url,false,$context);
var_dump($result);
?>
But when I go to thankyoupage.php?tx=ID, where 'ID' is the transaction ID, I get the following:
string(16) "FAIL Error: 4020"
I can't find any documentation that details what this error means, and am completely stuck, so I'd be grateful for any feedback.
回答1:
Most probably your Authentication Token ($pdti
) is incorrectly entered.
来源:https://stackoverflow.com/questions/18002062/paypal-sandbox-pdt-fail-4020