简体   繁体   中英

Paypal shows error message despite successful payment transfer

This is the first time i am integrating Paypal in a website. I have made two sandbox accounts for testing. The payments are successfully made but when it redirects to my success.php page I get the error message that payment failed. Here is my success.php page

echo $item_no            = $_REQUEST['item_number'];
echo $item_transaction   = $_REQUEST['tx']; // Paypal transaction ID
echo $item_price         = $_REQUEST['amt']; // Paypal received amount
echo $item_currency      = $_REQUEST['cc']; // Paypal received currency type

echo $price = '10.00';
echo $currency='USD';

//Rechecking the product price and currency details
if($item_price==$price && $item_currency==$currency)
{
echo "<h1>Welcome, Guest</h1>";
echo "<h1>Payment Successful</h1>";
echo "<h1>Click on the following link to get your code</h1>";
?>
<a href="complete.php?tx=<?php $item_transaction; ?>">Click Here</a>
<?php
}
else
{
 echo "<h1>Payment Failed</h1>";
}

I have tried to echo the four values but they do now show up. I do not get an error message such as $item_no not defined or $_REQUEST['item_number'] not defined either.

Can anybody help?

After searching around for days, I finally have an answer that solved my problem. PayPal does not send these variables to the sandbox anymore. If you have created your account now or after the policy update of 2013 then you would not get these variables.

I used a sandbox email that was created in 2012 and it solved y problem. I received the variables. I am not sure if I can share that email here, aka Terms and Conditions of Paypal sandbox or stackoverflow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM