Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paypal custom amount for "Donate Now" button

Tags:

paypal

I've been asked to implement Paypal "Donate Now" functionality on a web site, similar to Wikipedia's site.

I know how to generate "Buy/Donate Now" buttons with fixed amounts, and with variable amounts, but I don't see how Wikipedia is able to have the user specify the amount on their site and then have it carry over to Paypal, so that the amount is pre-filled once they get there.

Paypal's own documentation does not seem to support an "amount" field (or I've missed it). I actually called Paypal support and was told that I'd have to use a 3rd-party shopping cart for this functionality, but if the carts support this, isn't it just a form param?

like image 578
George Armhold Avatar asked Dec 17 '11 23:12

George Armhold


2 Answers

Yes, there's an HTML input parameter for this. Simply called 'amount'.
See https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables

Just include amount in any HTML input/select field and ensure you pass it over to PayPal. For example:

<label for="amount">Enter the amount you wish to donate:</label> 
<input type="text" id="amount" name="amount" value"">

Or;

<label for="amount">Select the amount you wish to donate:</label> 
<select name="amount" id="amount">
<option value="5.00">$5.00</option>
<option value="25.00">$25.00</option>
<option value="50.00">$50.00</option>
</select>
like image 113
Robert Avatar answered Oct 15 '22 23:10

Robert


Wikipedia uses some server-side scripting to create a transaction before it sends you to Paypal. This is the shopping cart functionality, yes, specifically the Express Checkout part.

I believe that this image illustrates the process:


(source: paypal.com)

Don't worry - it looks harder than it is: it's very easy to implement.

like image 31
Tom van der Woerdt Avatar answered Oct 16 '22 00:10

Tom van der Woerdt