PHP PayPal Subscription with IPN [closed]
Asked Answered
G

2

6

I am trying to learn how I can add PayPal Subscription to my existing PHP app using IPN and looking for a good article that explains the ins-and-outs.

In my app, users can register for a free account and then they can select a membership type and rate (daily, weekly, monthly and yearly). When they have made their selection, the configured PayPal button is displayed. They can click the Subscribe button which takes them to PayPal.

I need to know how to identify the user: what custom information to send to PayPal that is then sent back? I would also like to know what information PayPal sends back to the IPN page.

It seems that the button can be configured for the notify url. Does that mean I still have to turn on IPN?

I just have too many questions to list here... The PayPal site does not have any teaching material that explains Subscriptions and how to integrate it into a site.

Any good and recent articles you know of?

Gumboil answered 14/1, 2011 at 0:23 Comment(11)
Stop vandalizing your questions. You have no right to do that.Latta
Look, we can do the delete-and-rollback game all day. It isn't going to help - in the end, a moderator will restore the original content. You can't ask 42 questions on a Q&A site, profit from the answers and your fellow users' time, and then delete the knowledge accumulated on a whim. Your question doesn't belong solely to you any more, it belongs to the public now. So just go away.Latta
@Latta - There's now 3 of us watching for this, Hopefully a mod sees the flags soon.Korean
@Tim yeah. He can't beat three of us :) I tend to wait for a mod to sort this though, the edit wars create a lot of noise in the revision histories that I think can't be removed.Latta
/me grabs some more popcorn. Amusing, this Friday Night ;)Prenotion
Yep. See this for explanation of the fun if you don't get it... imgs.xkcd.com/comics/duty_calls.pngEject
@Prenotion a fun side effect will be that come morning, all his questions will be Community Wiki. Kind of fitting, seeing as he's leaving :)Latta
@Pekka, SO is simply beautiful, isn't it?Prenotion
@Prenotion it's a source of knowledge and entertainment in one! :) But things like this make me think it is really well engineered, too. You can't break anything you have published under the Wiki license, not for goodLatta
@please you licensed your contributions to Stack Overflow under the CC-Wiki license. SO has a right to publish them, and you do not have a right to remove them. Just walk away, your account will be deleted in time - but the associated questions will not. People have invested time in them, and you have no right to vandalize them. Give the deletion some time - it's the weekend, after all.Latta
We are exercising our right to share and remix. Sorry.Portis
E
1

There are plenty of articles out there, just google it. The date doesn't matter as much, most of the main functionality is basically the same, they don't change it much because a ton of people rely on it being the same. What you really need to do though, is look at the documentation at paypal, its quite thorough, and even has code samples. Including for subscriptions, how do you think the people who wrote articles, and everyone who has implemented it did it? Did they just guess and hope for the best?

Next get yourself an account on the paypal sandbox. Want to know what the IPN sends back? Setup a script to catch an IPN post, and save all the $_POST data to a file, and see for yourself using the sandbox to complete a fake order. Thats what I did when implementing paypal. Of course, the return values are also noted in the documents as well.

Edit

I believe the field they will send back is called custom. You could hijack a field you are not using, like productnumber. Or maybe use the payer_id field. Or identify them with their email. There is not just one way to do it. The best way to find out though, is to try it on the sandbox rather than waiting for someone to do it for you or write an article. You could have saved yourself 3 days of reading if you would just try it.

Links

Found these in about 2 minutes, there is more than enough info in these to get the job done.

Various IPN and subscription tutorials:
http://net.tutsplus.com/tutorials/php/using-paypals-instant-payment-notification-with-php/
http://www.web-development-blog.com/archives/easy-payments-using-paypal-ipn/
http://www.paymentsplus.com.au/joomla/faq/paypal-buy-now-guide.html

Sandbox:
https://developer.paypal.com/devscr?cmd=_signup-run

Paypal Documentation:
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_subscribe_buttons (this is the one you really want)
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro

Expression answered 14/1, 2011 at 2:56 Comment(3)
I have been reading through articles for the past three days. I have yet to find one that has the things I am looking for. Why would I come here and post a question if I could find it on google??? Also could not find any post on this site with decent answers. If you know of a good one that answers my question please feel free to include it in your answer! ...and if you know the links to the paypal docs that has what I'm looking for, also please free to include it in your answer.Gumboil
If you want a more specific answer, ask a specific question; the answer is a good start for most people who would want to ask that question. Stop vandalizing. It doesn't help you get your answer, does it?Eject
Unfortunately documentation of PayPal is horrible. It is so confusing for developer that it requires a long time to understand what actually paypal can do for the business in all these different ways to take money. HORRIBLE. I spent hours trying to find ways to create button on sandbox. And I found that it is not located in the same place as on live website. WTF??!! Paypal get real!! One of the worst documentations I have worked with so far.Tennietenniel
D
3

anon445699, I completely agree with you about the subscribe information it mostly shows you how to generate a button with no parameters.

Maybe this will help some people in the future, it oulines all the possible parameters for subscriptions. I know it helped me https://www.paypalobjects.com/en_US/ebook/subscriptions/html.html

Dimitrovo answered 14/1, 2011 at 0:23 Comment(0)
E
1

There are plenty of articles out there, just google it. The date doesn't matter as much, most of the main functionality is basically the same, they don't change it much because a ton of people rely on it being the same. What you really need to do though, is look at the documentation at paypal, its quite thorough, and even has code samples. Including for subscriptions, how do you think the people who wrote articles, and everyone who has implemented it did it? Did they just guess and hope for the best?

Next get yourself an account on the paypal sandbox. Want to know what the IPN sends back? Setup a script to catch an IPN post, and save all the $_POST data to a file, and see for yourself using the sandbox to complete a fake order. Thats what I did when implementing paypal. Of course, the return values are also noted in the documents as well.

Edit

I believe the field they will send back is called custom. You could hijack a field you are not using, like productnumber. Or maybe use the payer_id field. Or identify them with their email. There is not just one way to do it. The best way to find out though, is to try it on the sandbox rather than waiting for someone to do it for you or write an article. You could have saved yourself 3 days of reading if you would just try it.

Links

Found these in about 2 minutes, there is more than enough info in these to get the job done.

Various IPN and subscription tutorials:
http://net.tutsplus.com/tutorials/php/using-paypals-instant-payment-notification-with-php/
http://www.web-development-blog.com/archives/easy-payments-using-paypal-ipn/
http://www.paymentsplus.com.au/joomla/faq/paypal-buy-now-guide.html

Sandbox:
https://developer.paypal.com/devscr?cmd=_signup-run

Paypal Documentation:
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_subscribe_buttons (this is the one you really want)
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_admin_IPNIntro

Expression answered 14/1, 2011 at 2:56 Comment(3)
I have been reading through articles for the past three days. I have yet to find one that has the things I am looking for. Why would I come here and post a question if I could find it on google??? Also could not find any post on this site with decent answers. If you know of a good one that answers my question please feel free to include it in your answer! ...and if you know the links to the paypal docs that has what I'm looking for, also please free to include it in your answer.Gumboil
If you want a more specific answer, ask a specific question; the answer is a good start for most people who would want to ask that question. Stop vandalizing. It doesn't help you get your answer, does it?Eject
Unfortunately documentation of PayPal is horrible. It is so confusing for developer that it requires a long time to understand what actually paypal can do for the business in all these different ways to take money. HORRIBLE. I spent hours trying to find ways to create button on sandbox. And I found that it is not located in the same place as on live website. WTF??!! Paypal get real!! One of the worst documentations I have worked with so far.Tennietenniel

© 2022 - 2024 — McMap. All rights reserved.