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";
}
?>
autorun能在沙盒中工作嗎? 而且我使用個人paypal帳戶我沒有企業帳戶 所以「網站付款偏好頁」它在沙箱中工作? – 2014-09-30 06:19:49
是的,它可以像沙盒一樣在沙盒中工作。 我建議你在沙盒中創建一個商業帳戶。 – Vimalnath 2014-09-30 15:25:45