2014-09-30 189 views
0

我的測試在這裏http://evasoft.in/paypal/products.php。我是新的貝寶,我嘗試通過我的網站設置PayPal付款,並返回收集買家的信息,如交易ID,日期等。但我有付款失敗的錯誤,我沒有從貝寶得到任何價值。 我想在成功後自動重定向。paypal沙盒測試不會自動返回並且付款失敗錯誤

我的產品頁面的代碼

<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> 

這裏我Sucess.php頁面代碼

<?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

我做您的網站上測試結賬,能看見Auto Return功能開啓在您的沙箱帳戶上關閉

默認情況下自動返回功能處於關閉狀態。在https://www.paypal.com

1.To打開自動返回

2.登錄到您的PayPal帳戶。

3.出現我的帳戶概覽頁面。

4.單擊配置文件子選項卡。

5.出現配置文件摘要頁面。在銷售首選項列下,點擊網站付款 首選項鍊接。

6.出現網站付款首選項頁面,如下所示。

7.在網站付款自動退回下,單擊開啓單選按鈕啓用自動返回。

8.在退貨URL字段中,輸入付款人完成付款後重定向到的URL。

此外,請注意,如果使用借記卡或信用卡進行支付,自動退回功能將不起作用。您需要手動點擊「返回」鏈接才能重定向到您的返回網址。

+0

autorun能在沙盒中工作嗎? 而且我使用個人paypal帳戶我沒有企業帳戶 所以「網站付款偏好頁」它在沙箱中工作? – 2014-09-30 06:19:49

+0

是的,它可以像沙盒一樣在沙盒中工作。 我建議你在沙盒中創建一個商業帳戶。 – Vimalnath 2014-09-30 15:25:45