PayPal subscriptions PDT / IPN - PLEASE

最后都变了- 提交于 2019-12-01 05:31:11

Yeah sometimes is hard to understand Paypal and all their documentation but for any kind of subscription i would recommend Paypal IPN. You set IPN URL in your paypal account for example: http://www.domain.com/ipn.php. Then you create a subscription button in paypal account where you can set the price, recurring price etc.

More about Paypal IPN you can read here: https://www.paypal.com/ipn

When creating Paypal button you can also add some custom fields which can help you determine which customer really pays. So for example you have a database of users and there is user with userid=100, username=Nickname and registered_email=xxx@gmail.com. Now you can decide to add userid=100 as a custom field and add this to paypal button. For example CUSTOM=100.

ipn.php in this case is a script which handles all the logic. When user pay, Paypal send any status to http://www.domain.com/ipn.php (you set this in your paypal account as IPN URL). So ipn.php in this case needs to check if payment is complete and status is ok. Then retrieve a CUSTOM field ($_POST['custom']) which is in this case 100 (userid). And then update your database with users and somehow mark that this user payed of course if status is Completed.

Hope this helps a little. But in this case it's not really important from which paypal account user pays and which is registered in your database. All you need is that you somehow link it together. In this case with userid or something like that.

If you want to implement Paypal IPN and your customers don't use same email from my experience you can use a form to authenticate the user

  • user login on your website with xxx@example.org
  • user clicks on your item and pays with yyy@example.org
  • after he pays you can redirect him to a form where they can merge Paypal account with website account
  • every time that user pays then your IPN will be covered by the information he provided
  • you should save his payment information for later use.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!