Cannot pass amount from my site to paypal using the paypal generated donate button code.

jester6
Contributor
Contributor

I created a donate button allowing the user to enter the amount they wish to donate.  I added the following line to test:

 

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">

 

<input type="hidden" name="amount" value="25.00">      <!-- I added this line -->

 

<input type="hidden" name="cmd" value="_s-xclick">

<input type="hidden" name="hosted_button_id" value="MYCUSTOMBUTTONID">

<input type="image" src="https://www.paypalobjects.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.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">

 

Clicking the Donate button opens the Paypal site, but the amount is blank.

Login to Me Too
7 REPLIES 7

PayPal_RobG
PayPal Employee
PayPal Employee

You're using a 'hosted' PayPal button. You can't add in this variable directly in the code.

You'll need to go to your PayPal Profile > My selling tools > My payment buttons and update the button(s) listed there.

----
For technical assistance with PayPal merchant product offerings, please file a ticket at https://www.paypal.com/mts/
Login to Me Too

jester6
Contributor
Contributor

I don't understand what I need to update. There are only hosted buttons there. When I go into advanced options and add "amount" to the advanced variables Paypal generates the same script as when I don't have any advanced options.

Login to Me Too

PayPal_RobG
PayPal Employee
PayPal Employee

Hello jester,

 

The amount would actually be updated in Step 1 of the button creation tool (Action > Edit button).

The code will remain the same, but because the button is 'hosted' (all confidential information is securely stored with PayPal), it will be updated on our end. As soon as you update the button in the button tool, the proper amount will be used upon checkout.

----
For technical assistance with PayPal merchant product offerings, please file a ticket at https://www.paypal.com/mts/
Login to Me Too

jester6
Contributor
Contributor

Okay, I can edit the button to tell it to use the advanced variable "amount=0" in step 3 for the hosted Donate button. Now instead of a blank amount field on Paypal, I get a "0" regardless of the amount entered on my site.  It seems to me that the button is rather usless if I cannot pass the amount to Paypal with it.

 

What am I doing wrong?

Login to Me Too

PayPal_RobG
PayPal Employee
PayPal Employee

You shouldn't use the advanced variables section. Use the "Amount"  field in Step 1 instead.

----
For technical assistance with PayPal merchant product offerings, please file a ticket at https://www.paypal.com/mts/
Login to Me Too

jester6
Contributor
Contributor

Okay, so in step one there are two options for the amount. Enter a specified amout, such as $25. If I choose this amount then Paypal will always enter $25 for the amount regardless of the amount the user enters on my site. If I do not use the advanced variable and choose to let the user enter an amount in step one, Paypal will show a blank amount regarless of the amount the user enters on my site. There is no option to allow me to pass the amount from my site to Paypal.

Login to Me Too

tmblweed
Contributor
Contributor

I should have searched farther for my problem, as you are having the same issue as I.  I decided to not use a secure hosted button, and instead set the "cmd" input field to "_donations", and now I can fill in the "amount" input field to what ever I wish.  Unfortunately, it is not secure, but it appears to be the only way around my (and your) problem.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.