php - 将 PayPal 返回 URL 设置为本地主机

标签 php paypal payment-gateway sandbox paypal-sandbox

我正在尝试集成 Paypal,并且在此过程中使用了沙箱。我按照以下问题中接受的答案的步骤进行操作。 Setting PayPal return URL and making it auto return?

但是当我尝试输入 URL 时,Paypal 返回以下错误。

We were unable to validate the URL you have entered. Please check your entry and try again.

我要设置的 URL 是 http://localhost:8888/paypal/success.php

此外 我尝试使用以下表单发送返回 url。

<input type="hidden" name="return" value="http://localhost:8888/paypal/success.php">

这两种方法都不适合我。

完整表格

<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" value="dasun_1358759028_biz@archmage.lk" name="business">
<!-- Specify a Buy Now button. -->
<input type="hidden" value="_xclick" name="cmd">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" value="AM Test Item" name="item_name">
<input type="hidden" value="22.16" name="amount">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" value="item_number" name="item_number">
<input type="hidden" name="return" value="http://localhost:8888/paypal/success.php">
<!-- Display the payment button. -->
<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" >
</form> 

如何在我的开发电脑上测试它?

最佳答案

如果您尝试指定您的 IP 地址而不是 localhost 会怎样?

本地主机无法在远程机器上解析。只有您的本地 DNS 知道 localhost 语句并且是 127.0.0.1。

http://your-IP-address:8888/paypal/success.php

关于php - 将 PayPal 返回 URL 设置为本地主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14436483/

相关文章:

php - 存储到MySQL后base64错误

php - PHP脚本的任务划分

PHP htmlentities 只允许 <b> 和 <i>

codeigniter - 如何使用 Express Checkout 创建定期付款配置文件

php - 格式化 mysql 的输出(值数组)

Paypal 付款方式

paypal - 如何修复错误 400 加载 PayPal SDK JS

php - Paypal 代码错误。重定向到错误 400

add - Omnipay如何添加新网关

Magento 使用 PayPal 处理信用卡而不重定向到 PayPal