1
votes

Hello guys I have this frustrating problem with the Buy Now paypal button.

I want my customers to be able to pay with a debit/credit card through paypal without having to create a paypal account while at the same time I want to be able to pass down different pricing variables to paypal based on the product type the customer chooses.

When I use the encrypted cmd _s-xclick hidden variable on the button form my customers are given the option to pay with a credit card without having to create a Paypal account which is what I want. The problem with this option though is that it doesn't give me the ability to modify the hidden variable with name "amount" so I can pass the price amount to paypal.

FORM 1 BELOW: Gives my customers option to pay without creating Paypal account but makes them input the price of the item at checkout and thus not allow me to modify amount field since it's a hosted button.

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="xxx">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="item_name" value="Silver Plate">
<input type="hidden" name="amount" value="'.$price.'"> // THIS FIELD NOT READ BY PAYAPL
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="https://www.foo.com/success">
<input type="hidden" name="cancel_return" value="https://www.foo.com">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_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">
</form> 

However, if I use the the non-encrypted cmd _xclick hidden variable then it does allow me to modify the "amount" price hidden variable but then the option link for my customers to pay with a credit card without having to create a paypal account is replaced by a link that makes my customers create a paypal account if they wish to pay with a credit card.

FORM 2 BELOW: Does not give my customers option to pay without first creating a Paypal account but it does allow me to modify price amount field to pass down to PayPal.

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="hosted_button_id" value="xxx">
<input type="hidden" name="business" value="[email protected]">
<input type="hidden" name="item_name" value="Silver Plate">
<input type="hidden" name="amount" value="'.$price.'"> // THIS FIELD IS READ BY PAYPAL
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="https://www.foo.com/success">
<input type="hidden" name="cancel_return" value="https://www.foo.com">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif"     border="0" name="submit" alt="PayPal - The safer, easier way t$
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1"   height="1">

How can I get a Buy Now button with ability to modify the "amount" variable in the backend and read by Paypal while also giving my customer the option to pay without needing to create a paypal account?

ADDITIONAL INFORMATION

  • Our business resides in the US
  • We have a paypal business account type which is 100% verified.
  • Paypal Optional settings is set to YES
  • The majority of paying customers will be US based.
1

1 Answers

0
votes

You could switch to using the Express Checkout API instead of standard buttons. That will free you to do everything you're wanting to do.

If you know PHP my PayPal class library will make integrating Express Checkout very simple for you.