To setup a quick Paypal IPN
This quicky uses the code from
http://code.google.com/p/paypal-ipn-class-php/
Download code; unzip; place in site;
Next create your Paypal Button form. Make sure it Posts to paypal.php.
Use paypal.php?sandbox=1 to test in the sandbox
<form action="paypal.php?sandbox=1" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="PAYPAL EMAIL ADDRESS"> <input type="hidden" name="lc" value="US"> <input type="hidden" name="item_name" value="Stuff"> <input type="hidden" name="item_number" value="123"> <input type="hidden" name="amount" value="2.99"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="button_subtype" value="services"> <input type="hidden" name="no_note" value="1"> <input type="hidden" name="no_shipping" value="1"> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form>
Next make sure you change the 2 settings for the emails and ADD the line for the SMTP server
define('EMAIL_ADD', 'PAYPALEMAIL'); // For system notification. define('PAYPAL_EMAIL_ADD', 'PAYPALEMAIL'); ini_set("SMTP", "mail.MAILSERVER.com");
Then down on line 96ish add the fields from your specific form to look like
$p->add_field('business', PAYPAL_EMAIL_ADD); //don't need add this item. if your set the $p -> paypal_mail. $p->add_field('return', $this_script.'?action=success'); $p->add_field('cancel_return', $this_script.'?action=cancel'); $p->add_field('notify_url', $this_script.'?action=ipn'); $p->add_field('item_name', $_POST['item_name']); $p->add_field('item_number', $_POST['item_number']); $p->add_field('lc', $_POST['lc']); $p->add_field('amount', $_POST['amount']); $p->add_field('cmd', '_xclick'); $p->add_field('rm', '2'); // Return method = POST
2 comments:
i am new can you help me with more details please
my email bikramtpa@gmail.com
Post a Comment