0

I want to display a message in php ($mymessage) after a successful paypal payement.

For example:

  1. A client want buy my product on www.mysite.com/product where there is a "pay with paypal" button.
  2. The client pay on paypal's website.
  3. The client is redirected on www.mysite.com/product where a new message appear ($mymessage).

I know it's possible to check with javascript if the payment is done and refresh automatically the page displaying the message.

Someone can show me the way? (link, ideas or script)

Any help is welcome!

user1568901
  • 45
  • 1
  • 7
  • Nothing for the moment. I don't know if i must use the paypal API or just a local script with cookie. I have this system to display message for a tweet, +1 or facebook like but i want it for paypal. – user1568901 Aug 22 '12 at 12:09
  • Try with enabling IPN (instant payment notification) function in paypal account. There are some programming required but you can specify "thank you" page where you can show the thank you message and also get some other info about payment with $_POST[]. You can see if it's successfull or not, payer email address etc. Read more here: https://www.paypal.com/ipn – StudioArena Aug 22 '12 at 12:15
  • Thanks but in my case i have several paypal accounts so it may be difficult to activate ipn in each. I will study that. – user1568901 Aug 22 '12 at 13:40

2 Answers2

0

You can use php variable:

$_SERVER['HTTP_REFERER']

but you shouldn't put in the message sensitive information because the header can be modified.

See that: is $_SERVER['HTTP_REFERER'] safe?

By the way, paypal let you an custom url (I think)

Community
  • 1
  • 1
0

You can do this by return url in paypal. In return url page you have to check the status of payment. if it succeed means you can store message in session and show it to user. after showing the message unset the session variable used for message. This is simple way to show the message.

I dont know what you are trying? i mention the shortest way for your question

Sample code to check the status in return url

$address_url= (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
$req = 'cmd=_notify-synch';
$tx_token = $_REQUEST['tx'];
if(isset($_REQUEST['st']))
$st = $_REQUEST['st'];

in $st , check the status.

Suresh kumar
  • 2,002
  • 1
  • 19
  • 28