我正在本地主机上工作一个 codeigniter 项目,其中我使用 paypal 沙箱支付方式进行付款。
我遇到一个问题,返回网址不会自动重定向,而且当我单击返回商家按钮时,它不会向我的网址返回任何参数。
我已经设置了 paypal 的所有设置,我已经设置了从 paypal 帐户自动返回,还设置了返回 url,但我仍然没有得到任何响应。我正在使用此表单和参数。
$paypal_url='https://www.sandbox.paypal.com/cgi-bin/webscr';
<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="userid" value="1">
<input type="hidden" name="credits" value="510">
<input type="hidden" name="amount" value="20">
<input type="hidden" name="cpp_header_image" value="http://112.196.5.114/psychics/component/images/logo.png">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="notify_url" value="http://112.196.5.114/psychics/dashboard/profile/return_url">
<input type="hidden" name="cancel_return" value="http://112.196.5.114/psychics/dashboard/profile/cancel_return">
<input type="hidden" name="return" value="http://112.196.5.114/psychics/dashboard/profile/return_url">
<button type="submit" class="btn btn-success"> Add Funds</button>
</form>
我不明白我的错在哪里。
最佳答案
您的代码没问题,只需在代码中添加以下行,清除浏览器的缓存 cookie,然后重试:
<输入类型='隐藏'名称='rm'值='2'>
注1:添加上述代码后,PayPal将以POST方法返回响应。
注 2:重新检查并确认必须从您的 PayPal 企业验证帐户启用自动返回。
您可以通过在 PHP 标记内的返回页面中添加以下行来检查响应:
print_r($_REQUEST);或 print_r($_POST);
有关 PayPal 按钮参数的更多帮助:check documentation
关于php - Paypal 无法在本地主机上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43392543/