PayPal and Forms not working - php

I've recently redesigned a site I'd originally built 2/3 years back. We used PayPal buttons for Gift Vouchers and Deposits, but neither are working on the new version.
One of the pages affected is http://www.louiseballantine.com/giftvouchers.php - you'll see that the buttons display properly, but nothing happens when clicked.
However, the old version of the page (and I've added the same code for the new button) works perfectly: http://www.louiseballantine.com/giftvouchers_old.php
Here is the code for the first button (copied and pasted from PayPal):
<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="497ZF2RU65YJQ">
<input type="image" src="http://www.louiseballantine.com/img/voucher05.png" border="0" width="100%" name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
As I said previously, there's also an issue with the contact forms, so this may not be a specific problem with the PayPal code. However, any assistance would be gratefully received.
Thank you.

Problem solved by removing bootstrap's integrated form-handling scripts.

Related

How to add specific amount in PayPal Donation

I'm trying to add a donation page with paypal integration. It works perfectly fine. But what I want to add is to first sign the form from my site and then send it to paypal as well as the selected amount of donation. I've also trid to put this code <input type="hidden" name="amount" value="<?php echo $total; ?>"> as per my research. But it's still not working. Please see my code below for your review/reference.
Code
<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="QWEVB36VTJYEG">
<input type="hidden" name="amount" value="88.00">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_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>
The result would be just like this: (Blank Value) (The value must be 88.00)
As far as I know, donations on Paypal can't be restricted to one single value. The amount input is ignored, to be sure that people who will donate are not being manipulated and forced to pay a price they did not choose.
However, if you want to propose some fixed prices, here is a Paypal Community code which will help you doing that.
EDIT: Here is a StackOverflow answer which is pretty clear and confirms my thoughts.

Why is my Joomla site giving me a PayPal donation button error?

I built a site for a nonprofit, using Joomla 2.5.17, and a template from JoomlaShine.
I'm getting an error on the PayPal donation link (see image): "PayPal cannot process this transaction because of a problem with the seller's website. Please contact the seller directly to resolve this problem."
I'm using PayPal code that was created from my account in the PayPal API/code generator.
I've tried every trick I've found on forums, incl. StackOverflow and PayPal's - nothing is working. It looks like very simple code; and it's been a week of hair-tearing frustration.
My level: Beginner; lousy at coding; please be kind... I'm trying to help a nonprofit.
Page where code exists: http://sledfund.org/index.php/modal-width-600-height-400-donate-to-sled-modal
Code I'm using:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post"
target="paypal">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="PMJUGLKQWEXPJ" />
<input type="image" name="submit"
src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif"
alt="PayPal - The safer, easier way to pay online!" />
<img src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif"
alt="" width="1" height="1" border="0" />
</form>
We also had an issue with a donate module which we were embedding in some articles. I assume that because you have the donate button in an article that it is actually a module and you are using {loadposition xxx} to embed it. Open the article in the Article Manager above above loadposition, add the following:
{emailcloak=off}
I'm not sure if this will fix your specific problem but worth giving it a try.

How to print an HTML code from a variable in PHP?

I am developing a PHP site, and have encountered the following problem.
I have this line of code:
<div id="buynow"><?php echo $buynow; ?></div>
The variable $buynow has an html code (a paypal buy now button), and I would like to print/echo the html code that it gets processed.
With the current code, it prints the html code itself, not the desired result.
Thanks in advance
String:
<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="XXXXXXXXXXXX">
<table>
<tr><td><input type="hidden" name="on0" value="Colors">Colors</td></tr><tr><td><select name="os0">
<option value="Black">Black </option>
<option value="White">White </option>
</select> </td></tr>
</table>
<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>
Note: The value is replaced to XXXXXXXXX on purpose, in the code it is the original.
maybe try this:
<div id="buynow"><?php echo htmlspecialchars_decode($buynow); ?></div>
or use
<div id="buynow"><?php echo html_entity_decode($buynow); ?></div>
The method I use on simple Paypal button sites is to save the button code as little php files on their own (can just be the html making up the Paypal button). Then "include" the external file at the relevant point. It makes managing the buttons relatively easy without changing your source code.
Other than that, it seems that your page may not actually be a php page.

How to display PHP code as a string inside other PHP code

I need to paste this code at admin panel and then display Paypal Button on website.
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="6UKjJ8hU6ML5f">
<input type="hidden" name="custom" value="<?php print($_SESSION['mid'].'-'.$_SESSION['mps']);?>">
<input type="image" src="https://www.sandbox.paypal.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.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Then, need to display this code on website using following code.
print $rs->fields("ppbutton");
Now, problem is that due to PHP code inside Paypal form, whenever I try to print above value (paypal button) on website, it's giving error because of PHP code inside another PHP code.
I also think, print htmlentities($rs->fields("ppbutton"));
is the best option for you.
You can get the most recent updates about the function from this site.
http://php.net/manual/en/function.htmlentities.php
print htmlentities($rs->fields("ppbutton"));

PayPal Buy Now button: Add my own price?

I have a form that a user fills out prior to reaching the PayPal Buy Now button. The form contains information such as the users name and the amount they will be paying (in a hidden field).
I know there probably is a way to pass the name variable to PayPal using the Advanced Variables feature, but is there a way to alter the buttons price?
And can I do this using PHP variables?
Eg: item_name=<?php $myitem ?>
Any advice would be great! Thanks
EDIT: Form as requested
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="XXXX">
<input type="image" src="https://www.paypalobjects.com/en_AU/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_AU/i/scr/pixel.gif" width="1" height="1">
</form>
If I understand correctly your question, you have to put the amount hidden field on paypal form.
e.g.
<input type="hidden" name="amount" value="100">
<input type="hidden" name="currency_code" value="USD">
This form will prompt paypal to ask $100 from buyer.
of course you can add your own var there e.g.
<input type="hidden" name="amount" value="<?php echo $amount;?>">
HTH
I cannot even get this working with an unhosted button. It seems Paypal never lets you change the amount. I see it like this :
hosted button : amount is set in the code pointed to by the 'hosted button id'
unhosted button : PayPal encrypts the information, of which amount is part of
so, in either case you cannot change it, or at least, I haven't been able to do this.
Having said that, there is a variable called 'amount' you can use. So, I'm very confused about this.

Categories