PayPal subscriptions PDT / IPN - PLEASE

前端 未结 2 1332

Am having a lot of trouble getting my head around this paypal payment stuff...

How can i confirm that the user has successfully signed up for my subscription

相关标签:
2条回答
  • 2021-01-13 03:33

    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.

    0 讨论(0)
  • 2021-01-13 03:46

    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.
    0 讨论(0)
提交回复
热议问题