With paypal api, payment operation such as buy, donate, subscribe has never been easier. For simple cases, you just need to define a button inside paypal and embed it in your website, usually on blog sites that ask for donation.
For cases that requires callback event, so that the website can show a message on whether the transaction is successful or not:
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables
IPN variables: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables
But in your notify url, what if you want to post user defined variables such as user id, etc? In this case I use the optional parameters from paypal on0, on1, os0, os1. You can see them in the first website I've mentioned above. So our form becomes
<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr"> <input type="hidden" value="_donations" name="cmd"> <input type="hidden" value="youremail" name="business"> <input type="image" border="0" alt="" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif"> <input type="hidden" value="My Item" name="item_name"> <input type="hidden" value="10" name="amount"> <input type="hidden" value="USD" name="currency_code"> <input type="hidden" value="http://yourreturnurl.com" name="return"> <input type="hidden" value="http://yourcancelurl.com" name="cancel_return"> <input type="hidden" value="http://yournotificationurl.com" name="notify_url"> </form>You can refer to this website for paypal variables:
https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables
IPN variables: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables
But in your notify url, what if you want to post user defined variables such as user id, etc? In this case I use the optional parameters from paypal on0, on1, os0, os1. You can see them in the first website I've mentioned above. So our form becomes
<form method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr"> <input type="hidden" value="_donations" name="cmd"> <input type="hidden" value="youremail" name="business"> <input type="image" border="0" alt="" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif"> <input type="hidden" value="My Item" name="item_name"> <input type="hidden" value="10" name="amount"> <input type="hidden" value="USD" name="currency_code"> <input type="hidden" value="http://yourreturnurl.com" name="return"> <input type="hidden" value="http://yourcancelurl.com" name="cancel_return"> <input type="hidden" value="http://yournotificationurl.com" name="notify_url"> <input type="hidden" value="user_id" name="on0"> <input type="hidden" value="1" name="os0"> </form>And in your notify url, you should have a post variables: option_name1=user_id option_selection1=1
Post a Comment