How to pass and post back user defined variables in paypal ipn
Tech-Today

How to pass and post back user defined variables in paypal ipn


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:
<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




- How To Upload A File In An Mvc3 C# Ajax Form
It's easy to upload file in a synchronous form, where you just post the file and read a HttpPostedFile variable in the server side: In plain html form, take note of the form enctype property: //the view (index.cshtml) @using (Html.BeginForm("Upload",...

- Add A Jquery Datepicker On Jquery Dialog Box Via Load Method
Recently I've worked on a form that requires a jquery datepicker to be rendered inside jquery's dialog element. Where I encountered several problems like: 1.) datepicker() should be invoke inside dialog 2.) the dialog created (div) should be remove...

- Clear The Values Of Html Input Fields No Cache
There are times when you don't want to show the values previously entered and process of a certain html form. For example on a public PC that is used by anybody, if you type in your email address on any email site like gmail, yahoo you will notice...

- Paypal 10501 Failure In Transaction Invalid Configuration Error
Recently, we want to setup our store such that it should accept credit card payments without leaving our domain. The process is quite different compared to accepting payment via paypal's express checkout where the user is redirected to paypal to make...

- How To Order The Textboxes In An Html Document By Using Html Tag Tabindex
In Visual Studio TabIndex is a property that is accessible in each control, I thought there was no equivalent in plain html. So what I did was to manually captured the control's (example textbox) onblur event. It was working well until I found a bug,...



Tech-Today








.