How to Integrate PayPal Donate Button into ASP.NET Page

Date: 21 Jan 2010 Comments: 3 so far

I’ve recently decided to add PayPal Donate Button in the current site. The generated code for the donate button was:

<form action=”https://www.paypal.com/cgi-bin/webscr” method=”post”>
<input type=”hidden” name=”cmd” value=”_s-xclick” />
<input type=”hidden” name=”hosted_button_id” value=”11271506″ />
<input type=”image” src=”https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif” border=”0″ name=”submit” alt=”PayPal – The safer, easier way to pay online!” />
<img alt=”" border=”0″ src=”https://www.paypal.com/en_US/i/scr/pixel.gif” width=”1″ height=”1″ />
</form>

Adding the donate button code in the blog was easy (it’s wordpress), but in the entire part of the site it was a problem, because it’s written in asp.net.

I’ve search for many solutions but most of them are too complicated, ex. why should I add 3rd party control for a simple paypal donate button!?

The form above can be re-written also in HTML:

<a id=”paypalDonate” target=”_blank” href=”https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=11271506″>
<img border=”0″ id=”payPalImage” src=”https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif” alt=”Donate to DevtheWeb.NET” />
</a>

If you want to use to code above, all you need to do is to replace hosted_button_id’s value with your value, generated for your form by PayPal and that’s really all :)

 
Is it awful to have only one server-side Form tag in asp.net page?
 
 
 
  1. 3 Comments to “How to Integrate PayPal Donate Button into ASP.NET Page”

    1. Craig says:

      Worked great, thanks!

    2. Richard says:

      Works like a charm. Thank you!!

    Leave a Reply


    Spam protection by WP Captcha-Free