我正在创建我的沙箱帐户进行测试。我可以执行付款成功,但我也会重定向到我的成功页面,但是在加载成功页面时我无法获得TX参数。
我在我的表单中传递了返回网址,我也在我的PayPal帐户中设置了返回网址,并且还转为付款数据传输,但是在加载成功网页时我无法获取任何参数。
<?php
$paypal_url='https://www.sandbox.paypal.com/cgi-bin/webscr'; // Test Paypal API URL
$paypal_id='my-id-facilitator@gmail.com'; // Business email ID
?>
<form action='https://www.sandbox.paypal.com/cgi-bin/webscr' method='post' name='form1'>
<input type='hidden' name='business' value='Demo for paypal'>
<input type='hidden' name='cmd' value='_xclick'>
<input type='hidden' name='item_name' value='demo'>
<input type='hidden' name='item_number' value='1'>
<input type='hidden' name='amount' value='1'>
<input type='hidden' name='rm' value='1'>
<input type='hidden' name='no_shipping' value='1'>
<input type='hidden' name='currency_code' value='USD'>
<input type='hidden' name='cancel_return' value='http://my-site.com/cancel.php'>
<input type='hidden' name='return' value='http://my-site.com/success.php'>
<input type="image" src="https://paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" name="submit">
</form>
<?php
$item_transaction = $_GET['tx']; // Paypal transaction ID
$item_price = $_GET['amt']; // Paypal received amount
$item_currency = $_GET['cc']; // Paypal received currency type
echo $item_transaction;
echo "<br>".$item_price;
echo "<br>".$item_currency;
?>