Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PayPal subscriptions PDT / IPN - PLEASE

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?

I know 0 about IPN but for example : If a user signs up to my website with [email protected] but uses the paypal account [email protected] to pay then how to i match up the user.

I read that PDT do not send out a transaction ID (tx) for recurring (subscription) payments is that true ?

Just need help with it all... honest and easy :)

Thanks.

like image 519
Jason Avatar asked May 08 '12 10:05

Jason


1 Answers

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 [email protected]. 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.

like image 179
StudioArena Avatar answered Oct 23 '22 09:10

StudioArena