Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paypal: trying to pass an amount with a Donation button

I have a Donate button set up for the user to enter the donation amount. I am trying to send an amount with the button. I can enter amount=1.00 in the Add Advanced Variables in the button setup - that works fine. However, I have had no success sending the amount as part of the URL. I have added the following line to the PayPal button form:

<input type="hidden" name="amount" value="9.99" />

but the amount field is blank when I get to PayPal. Any thoughts what I am doing wrong?

like image 525
user2647353 Avatar asked Aug 02 '13 21:08

user2647353


People also ask

How long does it take for PayPal to process a donation?

PayPal Giving Fund. We then grant the funds to donor-recommended charities. If charities are enrolled in PayPal Giving Fund, they typically receive funds in their PayPal accounts 15-45 days after PayPal Giving Fund's receipt of a donation.


1 Answers

If you're creating a so called 'hosted button' (that is, a button where the button details are stored on the PayPal side), then the 'amount' POST parameter is ignored for requests to https://www.paypal.com/cgi-bin/webscr.
This is a security feature to prevent people from being able to manipulate the amount passed to PayPal for checkout.

You can identify whether you're using a hosted button by the following data;
Hosted buttons will have a value for cmd of _s-xclick and include the hosted_button_id parameter.

If this is the case, you cannot update the amount by passing in an extra amount POST parameter.

However, because you're dealing with donations and the amount is flexible by definition, you don't in fact need a 'hosted button'. In the button creation form, turn off 'Host button with PayPal', or write your own to point to PayPal.
If you do this, you can set the amount via the amount POST parameter.

For example, the below works fine;

<form method="POST" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_donations">
<label for="amount">Amount: </label><input type="text" name="amount" value="">
<input type="submit" name="submit" value="Pay with PayPal">
</form>
like image 76
Robert Avatar answered Oct 04 '22 03:10

Robert