I’m playing around with some eCommerce stuff with PayPal Sandbox. So far this is how the application flows:
- User logs in, server stores user_id in a session from the database. User can then click a buy now button once logged in. Takes them to paypal, they login and do payment, and IPN receives the notification fine 🙂
The only thing I now want to do to extend it, is create away of the IPN receiving the users_id back so I can set a flag on their database entry. Can this be done in PayPal?
I have tried the following with the view:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="--ID-FROM-PAYPAL--">
<input type="hidden" name="user_id" value="<?php echo $user_id;?>">
<input type="image" src="https://www.sandbox.paypal.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.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Thanks for the help 🙂
Your IPN will receive the userID in the
$_POST['custom']variable.If you want to pass more than one value to Paypal and back to your IPN:
For further information check the paypal IPN:
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables#id091EAB0105Z