7

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?

George Armhold
  • 30,824
  • 50
  • 153
  • 232
  • I describe how to do it here: http://stackoverflow.com/questions/33115582/which-paypal-service-is-better-for-online-transaction-for-website/33115649#33115649 – curls Oct 14 '15 at 20:47

2 Answers2

9

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>
Robert
  • 19,326
  • 3
  • 58
  • 59
  • 2
    Is this functionality still working? Adding a text input called "amount" (both id and name) does not result in the entered amount being carried over to PayPal - the amount field is still 0 on the landing. – shacker Feb 01 '14 at 17:08
  • I'm using something similar and it's currently working, where the user enters their own amount and I pass that to paypal into a shopping cart. – curls Oct 14 '15 at 20:41
  • There's a typo: value"" should be value="" or I leave it off. I describe how to do a user-entered price in detail here: http://stackoverflow.com/questions/33115582/which-paypal-service-is-better-for-online-transaction-for-website/33115649#33115649 – curls Oct 14 '15 at 20:44
4

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.

Community
  • 1
  • 1
Tom van der Woerdt
  • 29,532
  • 7
  • 72
  • 105
  • 1
    Wikipedia uses Website Payments Standard (a PayPal `
    `). It doesn't use Express Checkout. Just look at the source for https://wikimediafoundation.org/wiki/Special:ContributionTracking/en and search for "amount"
    – Robert Dec 18 '11 at 02:00
  • Robert- link seems broken. My view of the source at http://wikimediafoundation.org/w/index.php?title=WMFJA085/en/US&utm_source=donate&utm_medium=sidebar&utm_campaign=20101204SB002&language=en&uselang=en&country=US shows that they seem to be using PayflowProGateway. – George Armhold Dec 18 '11 at 02:04
  • That's for the credit card payment, which appears to be using PayPal Payflow Pro, which is another product altogether (and takes credit card payments directly). To see their Website Payments Standard implementation, choose an amount, click 'Pay via PayPal' and look at the source of that page. You'll find it there. (The link I gave was the actual page you get after opening that page, but it obviously requires to select an amount to donate first, sorry for the confusion). – Robert Dec 18 '11 at 02:07