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?
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>
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With