当我尝试这个脚本时,付款是成功的,但是当我重定向时,它说它已经失败了!我该怎么做!
index.php文件
<?php
$paypal_url='https://www.sandbox.paypal.com/cgi-bin/webscr'; // Test Paypal API URL
$paypal_id='CENSORING MY PAYPAL EMAIL'; // Business email ID
?>
<div class="btn">
<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="PHPGang Payment">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="credits" value="510">
<input type="hidden" name="userid" value="1">
<input type="hidden" name="amount" value="10">
<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://23.95.189.209/coen/test/cancel.php">
<input type="hidden" name="return" value="http://23.95.189.209/coen/test/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>
</div>
</div>
<?php
$title = "PayPal Payment in PHP";
$heading = "Welcome to PayPal Payment PHP example.";
?>
success.php文件
<?php
$item_no = $_REQUEST['item_number'];
$item_transaction = $_REQUEST['tx']; // Paypal transaction ID
$item_price = $_REQUEST['amt']; // Paypal received amount
$item_currency = $_REQUEST['cc']; // Paypal received currency type
$price = '10.00';
$currency='USD';
//Rechecking the product price and currency details
if($item_price==$price && $item_currency==$currency)
{
echo "Successful Payment";
}
else
{
echo "Failed Payment";
}
?>
我不确定为什么这不会起作用! 企业电子邮件ID是我自己的,但我已经把它拿出来了。