Connecting Tech Pros Worldwide Forums | Help | Site Map

Paypal notify_url

Member
 
Join Date: May 2007
Posts: 64
#1: Jul 8 '07
Hi I tried the notify_url but it didnt work can you see if I am doing any error.
or do i need to change any any setting in paypal site to activate notify_url


Here is my html code for the form
================================================
Expand|Select|Wrap|Line Numbers
  1. <input type="Hidden" name="cmd" value="_xclick">
  2. <input type="Hidden" name="business" value="username@hotmail.com">
  3. <!-- Allow customer to enter desired quantity -->
  4. <input type="Hidden"  name="undefined_quantity" value="1">
  5. <input type="Hidden"  name="item_name" value="Registraion">
  6. <input type="Hidden" name="item_number" value="">
  7. <!-- No currency_code variable has been specified, so monetary amount is assumed to be USD -->
  8. <input type="Hidden" name="amount" value="10">
  9. <! Passthrough variables for order tracking or other purpose -->
  10. <input type="Hidden" name="custom" value="">
  11. <input type="Hidden" name="invoice" value="">
  12. <input type="Hidden" name="charset" value="">
  13. <input type="Hidden" name="no_shipping" value="1">
  14. <input type="Hidden" name="return" value="">
  15. <input type="Hidden" name="cancel_return" value="">
  16. <!-- Do not prompt customer to include a note with the purchase -->
  17. <input type="Hidden" name="no_note" value="1">
  18. <input type="Hidden" name="rm" value="2">
  19. <input  type="Hidden" name="notify_url" value="">
  20. <input id=UserName style="WIDTH: 165px" tabindex=1 maxlength=16 name="Name">
  21. <input id=PasswordVerify style="WIDTH: 165px" tabindex=3 type=text maxlength=15 name="Phone">
  22. <input id=EMail style="WIDTH: 165px" tabindex=4 name="Email">
  23. <input type=submit value=Submit Now name=Authorize onClick="updatevaluesonsubmit()">
  24.  
  25.  
  26. <script language="JavaScript" type="text/JavaScript">
  27. function updatevaluesonsubmit() 
  28.  
  29.       notify_url = "http://mysite.com/Payment-Complete.php?";
  30.     notify_url = notify_url + "Name=" + frm.Name.value;
  31.     notify_url = notify_url + "&Phone=" + frm.Phone.value;
  32.     notify_url = notify_url + "&Email=" + frm.Email.value;
  33.     notify_url = notify_url + "&Country=" + frm.Country.value;
  34.     notify_url = notify_url + "&Product=" + frm.Registraion.value;
  35.     notify_url = notify_url + "&Amount=" + frm.amount.value;
  36.     frm.notify_url.value = notify_url;
  37. </Script>
****

When user clicks on submit I am running updatevaluesonsubmit javascript to update notify_url field (I checked this and it works fine)
then it opens paypal site but when user makes payment it does not run Payment-Complete.php.

here is the code of Payment-Complete.php to send email. but it does not send email
================================================== ====
Payment-Complete.php:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // multiple recipients
  3. $to  = '__MUNGED__'; //
  4. $companyname = 'My comany';
  5.  
  6. //Put name of cc. put " $cc = '' " if not required
  7. $cc = '__MUNGED__';
  8.  
  9. //Put name of bcc. put " $bcc = '' " if not required
  10. $bcc = '';
  11.  
  12. // subject
  13. $subject = 'Payment Complete';
  14.  
  15. // message
  16. $mailBody = '';
  17. $mailBody = $mailBody . '
  18. <table border="0" bordercolor="#000000" rowheight="30" width="400" cellspacing="1" celpadding="1">
  19. <tr>
  20. <td align="center" bgcolor="#CCCCCC" colspan="2" height="30"><b>
  21. <font face="Arial" size="2">Personal Details</font></b></td></tr>';
  22.  
  23. $mailBody = $mailBody . '<tr>
  24. <td align="right" bgcolor="#CCCCCC" height="30"><font face="Arial" size="2">Name : </td>
  25. <td bgcolor="#EAEAEA"><font face="Arial" size="2">';
  26. $mailBody = $mailBody . $_REQUEST['Name']."</td></tr>";
  27. $mailBody = $mailBody . '<tr>
  28. <td align="right" bgcolor="#CCCCCC" height="30"><font face="Arial" size="2">Email : </td>
  29. <td bgcolor="#EAEAEA"><font face="Arial" size="2">';
  30. $mailBody = $mailBody . $_REQUEST['Email']."</td></tr>";
  31.  
  32. $mailBody = $mailBody . '<tr>
  33. <td align="right" bgcolor="#CCCCCC" height="30"><font face="Arial" size="2">Phone : </td>
  34. <td bgcolor="#EAEAEA"><font face="Arial" size="2">';
  35. $mailBody = $mailBody . $_REQUEST['Phone']."</td></tr>";
  36.  
  37. $mailBody = $mailBody . '<tr>
  38. <td align="right" bgcolor="#CCCCCC" height="30"><font face="Arial" size="2">Product : </td>
  39. <td bgcolor="#EAEAEA"><font face="Arial" size="2">';
  40. $mailBody = $mailBody . $_REQUEST['Product']."</td></tr>";
  41.  
  42. $mailBody = $mailBody . '<tr>
  43. <td align="right" bgcolor="#CCCCCC" height="30"><font face="Arial" size="2">Amount : </td>
  44. <td bgcolor="#EAEAEA"><font face="Arial" size="2">';
  45. $mailBody = $mailBody . $_REQUEST['Amount']."</td></tr>";
  46.  
  47. $mailBody = $mailBody . '<tr> 
  48. <td align="right" bgcolor="#CCCCCC" height="30"><font face="Arial" size="2">Country : </td>
  49. <td bgcolor="#EAEAEA"><font face="Arial" size="2">';
  50. $mailBody = $mailBody . $_REQUEST['Country'].'</td></tr></table><BR><BR>';
  51.  
  52. $mailBody = $mailBody .'<font face="Arial" size="2">Thank you, <br><br>';
  53. $mailBody = $mailBody .'from<b> ' . 'ABC.com' . '</b><br><br><br></font>';
  54.  
  55.  
  56. $headers = '';
  57. // To send HTML mail, the Content-type header must be set
  58. //$headers  = 'MIME-Version: 1.0' . "\r\n";
  59. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  60.  
  61. // Additional headers
  62. $headers .= 'To: ' . $companyname . '<' . $to . '>' . "\r\n";
  63. $headers .= 'From: '.$_REQUEST['Name'].' <'.$_REQUEST['Email'].'>' . "\r\n";
  64.  
  65. if ($cc!='')
  66. {
  67.     $headers .= 'Cc:' . trim($cc) ."\r\n";
  68. }
  69.  
  70. if ($bcc!='')
  71. {
  72.     $headers .= 'Bcc: ' . trim($bcc) . "\r\n";
  73. }
  74.  
  75. // Mail it
  76. mail($to, $subject, $mailBody, $headers);
  77.  
  78. //Open thank you page
  79. //include("thank-you.htm");
  80. ?>
===================


Please help!!

Thanks,
Yogesh

pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#2: Jul 8 '07

re: Paypal notify_url


Heya, Yogesh.

What is your code doing that you don't want it to do? Give an example.
What is your code *not* doing that it is supposed to? Give an example.
Member
 
Join Date: May 2007
Posts: 64
#3: Jul 9 '07

re: Paypal notify_url


Quote:

Originally Posted by pbmods

Heya, Yogesh.

What is your code doing that you don't want it to do? Give an example.
What is your code *not* doing that it is supposed to? Give an example.


I want to achieve following
1. User submits his/her details(Name, Email, Phone) in HTML form.
2. Site is redirected to Paypal
3. As soon as user makes payment I want send an email to my self with the details submitted by the user.

My site does not run third step. Means it properly gets redirected to Paypal. And after payment it does not run the script(php file) specified by me in the notify_url variable.

Please help,
Thanks
pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#4: Jul 9 '07

re: Paypal notify_url


Heya, Yogesh.

Check out the PayPal IPN Class.
Reply