Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paypal sandbox PDT Fail 4020

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.

like image 984
David Avatar asked Dec 05 '25 03:12

David


1 Answers

Most probably your Authentication Token ($pdti) is incorrectly entered.

like image 200
silkfire Avatar answered Dec 06 '25 19:12

silkfire



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!