tags:

views:

68

answers:

2

I am new to integrating paypal with sites so maybe there's a readily available method from the service I could use? What I am trying to do is when the user clicks "return to my website", I want my return URL to know that the referrer is paypal so I can send him to the homepage automatically. How do I go about this? I tried $_SERVER['HTTP_REFERER'] but it doesn't seem to catch anything. I also set the cookie and session(though I am not sure if I made it right or it's the right thing to do) during IPN conversation, but when returning to my website, it doesn't seem to recognize any session. If I get away with this using $_SERVER['HTTP_REFERER'], I am afraid it is a security risk, right? If so, is there any other method I am missing? Help pls...

+1  A: 

Do you really need to know the referer? Set the PayPal return URL to a "secret" URL that always redirects to the homepage. If somebody ends up there and gets redirected without coming from PayPal, so what? It shouldn't be a problem.

Also, I haven't used PayPal, but I'd imagine any IPN notification will come as a request directly from PayPal's servers, not the user, so setting any cookies or sessions won't do you much good.

Matti Virkkunen
The homepage is a restricted area. Only registered users are allowed to enter. The scenario here happens after the user pays the subscription, so any server communication is absent.
adred
A: 

You can add a new hidden field with any custom value, that will be posted back to you. You could use that field for whatever you want. You should name that field custom.

Paypal will return back that field and once you see that you should be sure it has come from paypal.

Sarfraz
Yah, I have set up similar to that when verifying the existence of the user trying to subscribe. But the communication between my handler and IPN happens in the background right before the "return" is clicked. So, nothing actually happens after that because the click-button event doesn't involve IPN right?
adred