Reputation: 159
Im working on a website where I need to implement Paypal Payment.
I currently have let's say payment.php. I only want this file to be accessed when It's called by Paypal. In Paypal, you can assign the redirect link once the purchase is successful. In this case, I want it to be redirected to 'https://www.mywebsite.com/payment.php' but I only want this link to be accessed if it's called by Paypal. In my other pages, I use session to prevent access. Any idea how I can implement this? Thanks in advance!
Upvotes: 2
Views: 72
Reputation:
Use Paypal IPN:
Allow only POST, and implement the callback validation described in the IPN documentation.
https://github.com/dineshghule321/ipn-code-samples
https://developer.paypal.com/docs/classic/ipn/ht_ipn/ Paypal IPN Documentation
Upvotes: 0
Reputation: 1613
That should usually do the trick:
$_SERVER['HTTP_REFERER']
But as @DavidChen pointed out, if you are using some payment information, you need to check an endpoint and validate the request.
Upvotes: 3