Topic: [Tutorial] How to Get email after user buys something from your paypal

Hello,

Here is a tutorial on how to find out instantly when someone makes a purchase from your paypal

in this tutorial there will be 2 files

-payment.php -Gets Info
-orderconfirmation.php -Processes Info
================================

payment.php:

<?php 
/*
Free Payment Proccessing Script
Script Designed by JayDesigns
JayDesigns@live.com
*/

?>
<html>
<head>
<title> Order Page </title>
<style type="text/css">
div {
background-color:#b0c4de;
margin-top:100px;
margin-bottom:100px;
margin-right:400px;
margin-left:400px;
border-style:solid;
border-color:#98bf21;

} 



</style>

</head>
<body bgcolor="e5e4e4">
<center>
<div>
<h1> Order Page </h1>


<?php
if(isset($_GET['submit'])){

$email = $_GET['email'];
$name = $_GET['name'];

?>
<div>
<td width="33%" style="border-style: none; border-width: medium;">
                  
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" value="_xclick" name="cmd">
<input type="hidden" value="JneroCorp12345@gmail.com" name="business">
<input type="hidden" value="Item Name" name="item_name">
<table>
<tbody><tr><td>
  <p style="margin-top: 0pt; margin-bottom: 0pt;"><font size="3">Select</font></p></td></tr><tr><td>
  <p style="margin-top: 0pt; margin-bottom: 0pt;"> </p>
  <p style="margin-top: 0pt; margin-bottom: 0pt;"><select name="amount">
    <option value="10.00"> $10.00
    </option><option value="20.00"> $20.00
    </option><option value="30.00"> $30.00
</option></select> </p></td></tr>
</tbody></table>

<input type="hidden" value='./orderconfirmation.php?email=<?php echo "$email"; ?>&name=<?php echo "$name"; ?>' name="return">
<input type="hidden" value="1" name="no_note">
<input type="hidden" value="USD" name="currency_code"/>

<input type="image" height="47" border="0" width="122" alt="" name="submit" src="http://www.call52.com/btn_buynowCC_LG.gif"/>
<img height="1" border="0" width="1" src="pixel.gif" alt=""/>
</form>

</td>

</div>



<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
Name: <input type="text" name="name"><br>
Email: <input type="text" name="email"><br>
<input type="submit" name="submit" value="submit">
</form><br><br>
<font size="1">Payment Script Developed by JayDesigns@live.com</font>
</div>
<?php

}
?>

</center>
</body>
</html>
?>

</center>

and this would be the code for the orderconfirmation.php

<?php
/*
Free Payment Proccessing Script
Script Designed by JayDesigns
JayDesigns@live.com
*/

$myemail = "youremail@domain.com"; //Your Email Address

if(isset($_GET['email'])){

$name = $_GET['name'];
$email = $_GET['email'];

$to      = "$myemail";
$subject = 'Paypal Purchase Made';
$message = "A Paypal Purchase has been made bu $name , \r\n \r\n Here is the Information: \r\n Email: $email";
$headers = "From: $myemail" . '\r\n' . "Reply-To: $myemail" . '\r\n' . "X-Mailer: PHP/" . phpversion();

mail($to, $subject, $message, $headers);

} else {
?>
<font color="red"> Invalid Parameters </font>

<?php
}
?>

Thumbs up