duanqiao1961 2014-09-30 04:28
浏览 104

paypal沙盒测试不会返回自动和付款失败错误

My testing here http://evasoft.in/paypal/products.php. I am new in paypal, i am try to setup paypal payment via my website and return collect buyer's information like transaction id, date etc. But i got payment failed error and i doesn't get any value from paypal. I WANT AUTOMATIC REDIRECT AFTER SUCCESS.

My product page's code

 <form action='<?php echo $paypal_url; ?>' method='post' name='frmPayPal1'>
                    <input type='hidden' name='business' value='<?php echo $paypal_id;?>'>
                    <input type='hidden' name='cmd' value='_xclick'>

                    <input type='hidden' name='item_name' value='<?php echo $row['product'];?>'>
                    <input type='hidden' name='item_number' value='<?php echo $row['pid'];?>'>
                                   <input type='hidden' name='amount' value='<?php echo $row['price'];?>'>

                    <input type='hidden' name='no_shipping' value='1'>
                    <input type='hidden' name='currency_code' value='USD'>
                    <input type='hidden' name='handling' value='0'>
                    <input type='hidden' name='cancel_return' value='http://evasoft.in/paypal/cancel.php'>
                    <input type='hidden' name='return' value='http://evasoft.in/paypal/success.php'>

                    <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
                    <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
                </form> 

My Sucess.php page code here

<?php
require 'db_config.php';
$item_no = $_GET['item_number'];
$item_transaction = $_GET['tx'];
$item_price = $_GET['amt'];
$item_currency = $_GET['cc'];

//Getting product details
$sql=mysql_query("select product,price,currency from products where pid='$item_no'");
$row=mysql_fetch_array($sql);
$price=$row['price'];
$currency=$row['currency'];

//Rechecking the product details
if($item_price==$price && item_currency==$currency)
{

$result = mysql_query("INSERT INTO sales(pid, uid, saledate,transactionid) VALUES('$item_no', '$uid', NOW(),'$item_transaction')");
if($result){
  echo "<h1>Welcome, $username</h1>";
    echo '<h1>Payment Successful</h1>';
    echo "<b>Example Query</b>: INSERT INTO sales(pid, uid, saledate) VALUES('<font color='#f00;'>$item_no</font>', '<font color='#f00;'>$uid</font>', <font color='#f00;'>NOW()</font>)";
}else{
    echo "Payment Error";
}
}
else
{
echo "Payment Failed";
}
?>
  • 写回答

1条回答 默认 最新

  • dqch34769 2014-09-30 05:52
    关注

    I have done a test checkout on your website and could see that Auto Return feature is turned off on your sandbox account.

    Auto Return is turned off by default.

    1.To turn on Auto Return

    2.Log in to your PayPal account at https://www.paypal.com.

    3.The My Account Overview page appears.

    4.Click the Profile subtab.

    5.The Profile Summary page appears. Under the Selling Preferences column, click the Website Payment Preferences link.

    6.The Website Payment Preferences page appears, as shown below.

    7.Under Auto Return for Website Payments, click the On radio button to enable Auto Return.

    8.In the Return URL field, enter the URL to which you want your payers redirected after they complete their payments.

    Also, note that Auto Return Feature will not work if the Payment is made with Debit or credit card. You need to manually click in "return" link to get re-directed to your return URL.

    评论

报告相同问题?

悬赏问题

  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)