How to Integrate PayPal Donate Button into ASP.NET Page
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

6 Comments to “How to Integrate PayPal Donate Button into ASP.NET Page”
nice
Worked great, thanks!
Works like a charm. Thank you!!
Great Post! Thx a lot.
Hi,
Thanks for the post. I have another issue with paypal subscribe button. I have subscribe button with 4 subscription options (In html drop down list). I want to add this selected option in query string. So that my query string will look like this:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Y1TOJTYQ2ALDJ&os0=Silver Membership
In above query string I want to set selected option for os0 parameter. I am using same code as you have explain above.
My Code:
Memberships
Registration – One month : $1.00USD – monthly
Trial Membership : $25.00USD – monthly
Silver Membership : $250.00USD – yearly
Gold Membership : $400.00USD – yearly
Kindly suggest the way to pass subscription option through the query string.
Thanks in advance.
I am using PayPal subscription button with 4 subscription options.
I have used required field control for other controls on the same page, so when I click on Subscribe button it restrict form from posting to paypal account.
So I replaced following code
WITH
Now I want to add selected option in the query string.
https://www.paypal.com/cgi-bin/webscr?cmd=_s-lick&hosted_button_id=Y1TOJTYQ2ALDJ&os0=Silver Membership
In above query string I want to set selected option for os0 parameter.
My current Code:
….
Memberships
Registration – One month : $1.00USD – monthly
Trial Membership : $25.00USD – monthly
Silver Membership : $250.00USD – yearly
Gold Membership : $400.00USD – yearly
…..
So how can I add selected option in query string? or Is there any way to post a “frmPayPal” form only?
Thanks in advance