我正在开发在线商店应用程序,并且很难在我的通知URL中接收订单信息。遵循此文档,我创建了我的贝宝表单:
<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<fieldset>
<input id="buy" name="submit" type="submit" class="btn btn-primary" value="Buy" id="">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="item_name" value="My online store">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="amount" data-bind="value: amount">
<input type="hidden" name="notify_url" value="myurl/notify">
<input type="hidden" name="return" value="myurl/return">
<input type="hidden" name="cancel_return" value="myurl/cancel">
</fieldset>
</form>
其中“ myurl”类似于http://78.83.22.112
。我在本地apache服务器上运行我的应用程序。返回和取消网址按预期方式工作,但是Paypal似乎无法调用我的通知网址。我正在使用Laravel 4开发我的应用程序,因此这是我如何在route.php中管理通知URL的方法:
Route::post('/notify', 'CartController@notify');
这是我的notify方法:
public function notify() {
Log::info("Notify hit");
}
在IPN模拟器中测试了我的通知URL,结果是
很抱歉,我们无法连接到该URL。请确保输入正确。
我究竟做错了什么 ?为什么沙盒无法调用我的通知URL?
因此经过3天的战斗终于解决了这一问题。我没有在浏览器中键入“ localhost”,而是键入了我的外部IP,即我发送给Paypal的IP,以测试我的应用程序。我的通知URL被称为成功。不知道为什么,但是这解决了问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句