Pages should be accessible only if returned from paypal

hi all

i have paypal payment checkout integration on my website

on clicking checkout user is redirected to paypal website

if the payment is successfully paid then paypal redirects him to “pay_success.php” on my website

if payment is unsuccessfull then paypal redirect him to “pay_error.php” on my website

now i want that these pages

“pay_success.php” and “pay_error.php”

these 2 pages should only be accessible on my website if the user is redirected or returned from paypal only.

means these pages should not be accessible directly on my website.

how to do that ??


You could check HTTP_REFERER although it can be spoofed.

hi gandalf458

if it can be spoofed then what the other alternative ??


I don’t have an alternative. Hopefully someone else will have further suggestions.

use a Paypal IPN script to set a flag somewhere (in a database probably) to indicate that the person has made a successful payment then combine your success and error pages together and have the page check the flag to determine which version to display.

1 Like

i have tried IPN but its doesnt works instant or real time

it sometimes take 20 mins, 30 mins to notify

i dont know why they have named it Instant payment notification when its not instant.

on their blog also they accept that it may delay and its not instant.

so i cannot show message depending on IPN


It does process immediately as long as the payment is from Paypal funds or credit card - when from a bank account the payment isn’t processed for several days so you get one pending result straight away and a second complete result when you actually get the money.

You don’t actually have any payment until the IPN complete is received and so if you want the payment first it needs to work as I said - otherwise just let everyone go to the sucess page and hope that you eventually receive a payment from them.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.