繁体   English   中英

贝宝沙盒IPN PHP

[英]paypal sandbox IPN php

我正在使用Paypal Sandbox,我有一个订阅按钮,我的问题是如何获取有关付款的通知,例如交易ID或付款状态(如“待处理”,“成功”),以便我可以将其存储在数据库中。

我尝试搜索,到处都可以看到IPN,但我不知道如何实现,我确实在我的Paypal帐户中注册了IPN,并且我也有URL,我在该文件中编写了此代码

我的订阅按钮代码如下。

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="admin@cypherincorporated.org.in">
<input type="hidden" name="lc" value="IN">
<input type="hidden" name="item_name" value="unlimited">
<input type="hidden" name="return" value="http://103.8.216.147:81/UPS/index.php">
<input type="hidden" name="item_number" value="3">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="src" value="1">
<input type="hidden" name="a3" value="80.00">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="Y">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="bn" value="PP-SubscriptionsBF:btn_subscribeCC_LG.gif:NonHostedGuest">
<input type="image" src="images/apply.png" border="0" name="submit" alt="PayPal – The safer, easier way to pay online." style="margin:35px 0 0 70px">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">

沙盒付款工作正常,但我希望获得有关付款或状态的一些通知。

是的,您应该使用IPN来获取付款通知。 请注意,您的IPN侦听器文件应存在于实时服务器中。 IPN无法在localhost中运行。如果全部设置成功,您将收到IPN通知,您可以在获取IPN时检查服务器日志或发送自定义电子邮件,以检查您是否正在接收IPN。

要动态设置IPN,请使用notify_url变量:

    <input type="hidden" name="notify_url" value="http://path.to/your.ipn.php">

变量参考

    notify_url
        Optional
        The URL to which PayPal posts information about the payment, in the form of Instant Payment Notification messages.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM