我刚刚尝试在我的网站中集成PayPal支付网关。为此,我已经按照指南中显示的所有步骤进行操作,我可以付款,它向我显示成功的付款消息,我去了我的帐户,在那里我也可以看到付款交易信息PayPal。我得到零(0)而不是数据。
首先,我在PayPal中创建了一个开发人员帐户,然后通过我创建了一个企业和一个买家帐户。
这是我的代码
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" accept-charset="utf-8">
<input type="hidden" name="amount" value="21" readonly="" id="qty-1-amt">
<input type="hidden" name="price" value="21">
<input type="hidden" name="business" value="harsh-business@gmail.com">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="Test Mobile">
<input type="hidden" name="item_number" value="Test Item Number">
<input type="hidden" name="currency_code" value="USD">
<!-- Specify URLs -->
<input type="hidden" name="cancel_return" value="http://paymentgateway.alphansotech.com/buyproducts">
<input type="hidden" name="return" value="http://alphansotech.com/response.php">
<ul>
<li>Quantity: <input type="text" name="quantity" value="1" id="qty-1"> </li>
<li><strong>Total: </strong>$ <span id="qty-1-span">21</span></li>
<!--<li><input type="submit" name="submit" value="Buy"/></li>-->
<li> <input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif"></li>
</ul>
</form>
根据上面的评论,您在错误的位置查找数据。您正在寻找 $_POST,而默认情况下PayPal将返回值放在 $_GET 中。您需要做以下两件事之一。也:
1) 将代码从使用 $_POST 更改为 $_GET,或
2) PayPal发送值 rm=2 (") 以请求PayPal将这些返回变量从 GET 参数移动到 POST 参数。此处记录了以下内容:
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/