PDA

View Full Version : PayPal - This invoice has already been paid.



VintageWhite
18 Jan 2012, 02:33 PM
*I've posted this to a PayPal forum too, but it doesn't get much traffic. Go figure.

Apparently most donations go through, but some do not and will get the notification "This invoice has already been paid."

Said PayPal integration is on a basic website site (no WordPress, Drupal, or plugin stuff) and used for donations.
I'm starting to think with the lack of answers to this question, I might have to start from scratch (this isn't my coding). PayPal has been a nightmare for me the last few months.

Basically here's the code (I did not code this):





<? $url = "http://" . $_SERVER['HTTP_HOST'] . preg_replace("/(.*\/).*/", "$1", $_SERVER['REQUEST_URI']); ?>

<form id="gift" method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="business" value="email@domain.com">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="charset" value="utf-8">
<input type="hidden" name="return" value="<? echo $url; ?>thank_you.php">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="notify_url" value="<? echo $url; ?>thank_you.php">
<input type="hidden" name="shipping" value="0">
<input type="hidden" name="tax_cart" value="0">
<input type="hidden" name="image_url" value="<? echo $url; ?>images/bcf_logo.jpg">
<input type="hidden" name="cn" value="How do you wish your name to appear in our annual report?">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cancel_return" value="<? echo $url; ?>donate_now.php">
<input type="hidden" name="cbt" value="Return to the Bakersfield College Foundation">

...

<td>
<select id="Program" name="Program" size="1" onchange="
$other = document.getElementById('other_program').style;
$invoice = document.getElementById('invoice');
if (selectedIndex==4) {
$other.visibility='visible';
if ($invoice.value == 'General Fund') $invoice.value='';
} else {
$other.visibility='hidden';
if (selectedIndex==1) {
$invoice.value='Renegade Fund';
} else {
$invoice.value='General Scholarships';
}
}">
<option selected="selected" value="Not Selected">-- Select One --</option>
<option value="Renegade Fund">Renegade Fund</option>
<option value="General Scholarships">General Scholarships</option>
<option value="President's Circle">President's Circle</option>
<option value="Other">Other (specify)</option>
</select>
</td>
...

<td>
<select name="item_number" onchange="
$inhonor=document.getElementById('in_honor').style;
$itemname=document.getElementById('item_name');
if (selectedIndex!=0) {
$inhonor.visibility='visible';
if ($itemname.value == 'Anonymous Donor') $itemname.value='';
} else {
$inhonor.visibility='hidden';
if ($itemname.value == '') $itemname.value = 'Anonymous Donor';
}">
<option value="anonymously">Anonymously</option>
<option selected="selected" value="in honor of">In honor of...</option>
<option value="in memory of">In memory of...</option>
</select>
</td>

...

<td colspan="4" align="center"><input type="submit" value="Proceed to secure site to complete your donation process..." />

...

</form>




Sorry if its lengthy, or if I didn't grab something important. I'm not a PHP pro, but I'm not liking that id="Program" is using $invoice like that.


I know there is an option in PayPal to allow duplicate invoice IDs, but I'm not convinced that's an ideal option. I've seen where were a letter was added to an invoice ID, but I don't know how I would add it here, or this form was done completely wrong. Any help is greatly appreciated. Thanks!