Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PayPal "This invoice has already been paid."


Wendell

Recommended Posts

I am using the PayPal IPN for all PayPal payments... often, when someone places an order, they get an error message: "ERROR DETECTED: This invoice has already been paid. For more information, please contact the merchant." I cannot seem to find any problems and some payments do actually make it through with no problems. Any ideas? Thanks!

 

http://www.madamusements.com

Link to comment
Share on other sites

i'm having this same problem as well. And I created different oscommerce accounts and it keeps giving me this...

 

I too installed the osCommerce PayPal IPN Module v1.1 For 2.2MS2 and test it with Paypal sandbox. Having the exact same problem. Anyone please enlighten?

Link to comment
Share on other sites

I had the same problem, I may have found a solution...

It turns out for some reason paypal isn't accepting the invoice numbers, which are being created as 1, 2, 3.... etc... however if you go to includes/modules/payments/paypayl_ipn.php and change the line (I think 326) that says...

 

$parameters['invoice'] = substr($cart_PayPal_IPN_ID, strpos($cart_PayPal_IPN_ID, '-')+1);

 

to

 

$parameters['invoice'] = $cart_PayPal_IPN_ID;

 

Then the transaction should work and you will be returned to your site. However on paypay the Invoice number will be cartNo-InvNo where as in your osCommerce records it will just be InvNo. I'm still working on getting around that issue...

 

Hope this helps

Link to comment
Share on other sites

I had the same problem, I may have found a solution...

It turns out for some reason paypal isn't accepting the invoice numbers, which are being created as 1, 2, 3.... etc... however if you go to includes/modules/payments/paypayl_ipn.php and change the line (I think 326) that says...

 

$parameters['invoice'] = substr($cart_PayPal_IPN_ID, strpos($cart_PayPal_IPN_ID, '-')+1);

 

to

 

$parameters['invoice'] = $cart_PayPal_IPN_ID;

 

Then the transaction should work and you will be returned to your site. However on paypay the Invoice number will be cartNo-InvNo where as in your osCommerce records it will just be InvNo. I'm still working on getting around that issue...

 

Hope this helps

 

YES! Thank you. This does work. I don't understand why but it does. I've been searching for a solution for this problem for two days. This problem has prevented me from troubleshooting a totally different issue.

George

Link to comment
Share on other sites

  • 1 month later...
I had the same problem, I may have found a solution...

It turns out for some reason paypal isn't accepting the invoice numbers, which are being created as 1, 2, 3.... etc... however if you go to includes/modules/payments/paypayl_ipn.php and change the line (I think 326) that says...

 

$parameters['invoice'] = substr($cart_PayPal_IPN_ID, strpos($cart_PayPal_IPN_ID, '-')+1);

 

to

 

$parameters['invoice'] = $cart_PayPal_IPN_ID;

 

Then the transaction should work and you will be returned to your site. However on paypay the Invoice number will be cartNo-InvNo where as in your osCommerce records it will just be InvNo. I'm still working on getting around that issue...

 

Hope this helps

 

 

I have tried this solution and it works (as I have had the same problem), but the status wasn't getting updated upon paypal confirmation. I have changed the code in paypal_ipn.php as described in this quote and updated the ext/modules/payment/paypal_ipn/ipn.php file as listed below (at lines 79 & 128). I included the same substr($_POST['invoice'], strpos($_POST['invoice'], '-')+1) that was taken out in the quote and placed it below the if statement so it correctly parses the invoice number. I also had to remove one of the conditions that checks if the invoice number is below 0 (my returned invoice nums were negative which is why you need to strip out the '-'). I then replaced every other instance of $_POST['invoice'] with $invoice_id.

 

Don't know if this will help anyone else, but it works for me.

 

REPLACE

 

 if (isset($_POST['invoice']) && is_numeric($_POST['invoice']) && ($_POST['invoice'] > 0)) {

 

WITH

 

	if (isset($_POST['invoice']) && is_numeric($_POST['invoice'])) {
	$invoice_id =substr($_POST['invoice'], strpos($_POST['invoice'], '-')+1);

 

and every instance of $_POST['invoice'] to $invoice_id except for those instances replaced with the CODE above.

 

-Mike

Link to comment
Share on other sites

  • 4 months later...
Don't know if this will help anyone else, but it works for me.

 

Did you find that your order status no long updated after the order payement was made Mike ? We found that we suffered from the above problems of invoice 'already paid' and so I have gone through the steps outlined above.

 

Unfortunatly this paypal error seems to be random and all our own live payement tests always work for us, but we have had comments from a customer of the error and wish to solve it happeneing to other customers in the future. :'(

 

Anyway,

 

The code changes above have been made and I can only hope its fixed the problem as I cant test it - however after making these changes our shop no longer updates a cart from Paypal Preparing to Pending (I am assuming the new invoice number code isnt linking to a database record or something but this is all above my head.)

 

Can anyone point this newbie in the right direction on how to address this ? :-"

 

Thanks for any help in advance.

Steven

Link to comment
Share on other sites

  • 1 month later...

I turned on the old paypal module, and placed a couple of orders. Both osCommerce email notices to the store owner where "Order Number: 0"

 

Now, ... "Why?"

 

I made some changes to PHP configs for safety. This error may have started with those changes. One of those changes was in php.ini to turn php globals OFF. I had to turn globals back on to allow osCommerce to run.

 

What change would have resulted in resetting, and sticking the order number at 0 (zero)?

Link to comment
Share on other sites

The PayPal IPN module v1.3 contains a help file for this problem. Alternatively, follow link in my signature. Or for a really quick fix, just turn off order id checking in your PayPal account. all the best, Tera

My code for combining PayPal IPN with ** QTPro 4.25 ** osC Affiliate ** CCGV(trad)

and how to solve the invoice already paid error

General info: Allow customer to delete order comment ** FTP Programs & Text Editors ** Amending order email **

Link to comment
Share on other sites

The PayPal IPN module v1.3 contains a help file for this problem. Alternatively, follow link in my signature. Or for a really quick fix, just turn off order id checking in your PayPal account. all the best, Tera

 

Ya know... I've followed that link until I'm ready to puke. this forum software us almost utterly useless. Can you no create a page with your solution and post a link to that? Maybe I'm blind, but if you'd do me the favor of at least giving me the post #, I'd really appreciate it.

 

here's the page you link to in your sig: http://www.oscommerce.com/forums/index.php?sho...mp;#entry883395

 

Here are your posts on that page:

Post #1021

Post #1023

Post #1025

Post #1026

Post #1028

Post #1031

Post #1039

 

I do appreciate the help.

Link to comment
Share on other sites

Yes - the forum links are a bit wonky. It's post 1017 (and 1018) on page 51 of the PayPal thread. A second attempt at providing a link:

http://www.oscommerce.com/forums/index.php?s=&...st&p=883154

argh - just tested still goes to page 52, so you need to backtrack to page 51 .. no idea what's going on here!

 

Or just download this contrib and look under help files:

http://www.oscommerce.com/community/contributions,2679

 

Terra

Edited by Terra

My code for combining PayPal IPN with ** QTPro 4.25 ** osC Affiliate ** CCGV(trad)

and how to solve the invoice already paid error

General info: Allow customer to delete order comment ** FTP Programs & Text Editors ** Amending order email **

Link to comment
Share on other sites

If an invoice had been paid once then that invoice number is saved in paypal DB.

To avoid double payment paypal does not allow same invoice number to be paid again.

 

 

You need to chk db as due to some invoice or testing the logic got lost else just increment your invoice number by soome arbitary value and check.

 

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

  • 2 months later...

Ok there is a problem but easy (humm more less) to solve it; first this issue is due to your domain is sending, a duplicated id numbers: i.e. you have your real site and you are on an order number 100, also you begin a test store under your domain and your test store reach the order number 105. the problem beings when you make an order in your live site, for example order number 102, paypal shows that this order is already paid (your test site processed this order already).

 

The solution is modifying the order number on your database on orders table, (exist a manual about how to modify it). For example set up an order number 500; In addition make some transactions beginning from the new order id, in that way your orders will continue 501, 502, and 503 and so on. Avoiding duplicate order numbers against another store.

 

Note: you can make transaction using cash on delivery mean while you reach the order number necessary.

Or you can make transaction using:

REPLACE

 

 

CODE

if (isset($_POST['invoice']) && is_numeric($_POST['invoice']) && ($_POST['invoice'] > 0)) {

 

 

WITH

 

 

CODE

if (isset($_POST['invoice']) && is_numeric($_POST['invoice'])) {

$invoice_id =substr($_POST['invoice'], strpos($_POST['invoice'], '-')+1);

Link to comment
Share on other sites

  • 4 months later...

i need some help on this. i get this error for every order placed with paypal. i cannot even complete one order.

 

it is a brand new paypal account with no other shops using the account, so i can't see how it can be just a duplicate ID issue.

 

i have also made sure the "No, allow multiple payments per invoice ID" option is selected.

 

anybody got any ideas? it's driving me crazy :'( , and i can't put the site live until this is sorted.

 

many thanks,

tom

 

------------------------------------------

helstonbeauty.co.uk

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 months later...
i need some help on this. i get this error for every order placed with paypal. i cannot even complete one order.

 

it is a brand new paypal account with no other shops using the account, so i can't see how it can be just a duplicate ID issue.

 

Greetings. I've set up a new OS Commerce site, and registered the sandbox account (also new) with paypal. This sandbox account has never received a payment or invoice of any kind until I tried with the OS Commerce Paypal IPN module.

 

Without fail, I get the "This invoice has already been paid." error. I don't have duplicate stores; and once again, both the sandbox buyer and sandbox seller account have *never* been used before.

 

I've also tried the suggestions of clearing all cookies, and manually incrementing the order number with no success.

 

Is this not a problem I would see if I used live accounts? Should I apply the patch from earlier in the thread even though I don't have multiple stores? Has anyone had success with this recently that could point out to me where my flaw is?

 

Thanks for your time & help.

 

Clint

Link to comment
Share on other sites

simple solution.

Switch on cod make two order and then chek Paypal for invoice not paid.

As order number moves up this should take care.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

Also, interestingly, changing the seller to allow duplicate payments per transaction in the paypal profile does not resolve the issue.

 

Is there any manner of debug (other than the debug email, which as far as I can tell shows nothing for this problem) that I can enable to complete additional troubleshooting?

Link to comment
Share on other sites

I found the solution when dealing with the sandbox!

 

When dealing with the sandbox, when you get the "This invoice has already been paid." it can mean that the selling account isn't properly configured, or in my case, even though I configured it in the developer sandbox as "[email protected]" when I look in that interface, it shows the email address for the seller as:

 

[email protected]

 

That is the information you have to plug into the paypal ipn, not the email address you asked the dev account to use.

 

As soon as I put this email in as the seller email, it took right off!

 

Hope this helps others who come looking for the solution!

Edited by TheDruidXpawX
Link to comment
Share on other sites

  • 2 weeks later...

:rolleyes:

I found the solution when dealing with the sandbox!

 

When dealing with the sandbox, when you get the "This invoice has already been paid." it can mean that the selling account isn't properly configured, or in my case, even though I configured it in the developer sandbox as "[email protected]" when I look in that interface, it shows the email address for the seller as:

 

[email protected]

 

That is the information you have to plug into the paypal ipn, not the email address you asked the dev account to use.

 

As soon as I put this email in as the seller email, it took right off!

 

Hope this helps others who come looking for the solution!

 

Yes, you are right I had the same problem and did the same solution, I enter the sandpit email into the PayPal IPN module and not my real one and it worked for me.

 

Much easier than messing with code!

 

Thanks for this information

Link to comment
Share on other sites

  • 4 months later...
Yes - the forum links are a bit wonky. It's post 1017 (and 1018) on page 51 of the PayPal thread. A second attempt at providing a link:

http://www.oscommerce.com/forums/index.php?s=&...st&p=883154

argh - just tested still goes to page 52, so you need to backtrack to page 51 .. no idea what's going on here!

 

Or just download this contrib and look under help files:

http://www.oscommerce.com/community/contributions,2679

 

Terra

 

Implemented your recommended changes (post 1017) and things clicked right into place. Thanks. Now I cannot seem to get rid of this warning message:

 

Warning: mail(): SMTP server response: 550 Recipient cannot contain a space (<"Buyer Thirteen" <[email protected]>) in c:\program files\easyphp1-8\www\includes\classes\email.php on line 522

 

If I just refresh the page it clears the message and everything seems to be fine, but I don't like the message appearing. Have you run across this before?

 

Eddie

Link to comment
Share on other sites

the simplest way out is :

install COD place two three orders.

then chek with Paypal payment method.

 

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...