简体   繁体   English

贝宝沙盒IPN PHP

[英]paypal sandbox IPN php

I am working with Paypal Sandbox, i have a subscription button, my question is how do i get the notification about the payment, something like transaction ID or payment status like, 'pending', 'success' so that i can store in my database. 我正在使用Paypal Sandbox,我有一个订阅按钮,我的问题是如何获取有关付款的通知,例如交易ID或付款状态(如“待处理”,“成功”),以便我可以将其存储在数据库中。

i tried searching, i see IPN everywhere, but i do not know how to implement that, i did register for IPN in my paypal account and i have the URL as well, i wrote this code code in that file. 我尝试搜索,到处都可以看到IPN,但我不知道如何实现,我确实在我的Paypal帐户中注册了IPN,并且我也有URL,我在该文件中编写了此代码

and my subscription button code is as below. 我的订阅按钮代码如下。

<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">

the sandbox payment works fine but i want some notification about the payment or the status. 沙盒付款工作正常,但我希望获得有关付款或状态的一些通知。

Yes, you should use IPN for getting the payment notifications. 是的,您应该使用IPN来获取付款通知。 Note that your IPN listener file should exists in the live server. 请注意,您的IPN侦听器文件应存在于实时服务器中。 IPN will not work in localhost.If all set, you will receive IPN notificaiton and you could check your server logs or send customize email upon getting the IPN to check if you are receiving the IPN. IPN无法在localhost中运行。如果全部设置成功,您将收到IPN通知,您可以在获取IPN时检查服务器日志或发送自定义电子邮件,以检查您是否正在接收IPN。

To set the IPN dynamically use the notify_url variable: 要动态设置IPN,请使用notify_url变量:

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

From the Variable Reference : 变量参考

    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