custom amount on buy now button

azebot
Contributor
Contributor

I have a buy now button with my own custom button "Make Payment". The amount is calculated on the fly in my code and when user clicks the Make Payment button, my calculated amount is supposed to be populated in Paypal's payment processing page. Just to test the logic, I'm passing a 9.00 static value to the amount tag in the HTML, but it does not propogate to the paypal payment page. No matter what I do, it still shows 0.00 in the payment and the total values in Paypal. I don't want my customers to change the value. I want my value to be populated for them. Please help.

 

Below is my HTML:

 

<

formaction="https://www.sandbox.paypal.com/cgi-bin/webscr"method="post">

<

inputtype="hidden"name="cmd"value="_s-xclick">

<

inputtype="hidden"name="hosted_button_id"value="MYHOSTEDBUTTONID">

<

inputtype="hidden"name="item_name"value="Discount Service Charge">

<

inputtype="hidden"name="currency_code"value="USD">

<

inputtype="hidden"name="amount"value="9.00">

<

inputtype="image"src="http://paypaltest.azebot.com/MakePaymentButton.PNG"border="0"name="submit"alt="PayPal - The safer, easier way to pay online!">

<

imgalt=""border="0"src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif"width="1"height="1">

</

form>

Login to Me Too
2 REPLIES 2

azebot
Contributor
Contributor

I guess no one knows how to handle this. I've noticed some responses to other requests, which state it is not possible due to security reasons. However, if I change the button to cart type, it works. I would think if it was a security issue, it should not have worked with cart button type either. The issue with cart type button is that the check out page has "Continue Shopping" button and "Your Shopping Cart" label that I am not interested with.

 

If any one has any suggestions, please reply.

 

Thanks,

 

 

Login to Me Too

PayPal_RobG
PayPal Employee
PayPal Employee

Hi azebot,

 

Correct, you can't pass in an amount via the 'amount' HTML parameter on-the-fly if your button is hosted with PayPal, since that would defeat the purpose of a hosted button.

 

There are two options:

1. Use the BMUpdateButton API to update the button.

Since this is secured via your API credentials, you can use this API to update this data for hosted buttons.

 

2. Don't use a hosted button

Simply create a new button, and untick 'Host button with PayPal' in Step 2 of the button creation tool.

This will then let you pass in any amount via the 'amount' parameter.

----
For technical assistance with PayPal merchant product offerings, please file a ticket at https://www.paypal.com/mts/
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.