Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Paypal Telling users The invoice has already been paid contact Merchant


rob0362

Recommended Posts

Paypal Telling users The invoice has already been paid contact Merchant.

 

This is with the IPN v2.3.4.7 and 2.2rc2a Software

 

Any Ideas?

 

Thanks

This text is in a file in the contrib. if you look:

 

"This invoice has already been paid" PayPal error message

 

Background:

The PayPal IPN sends a parameter "invoice" to PayPal. This parameter is equal to the order ID (1,2,3,4 etc). However, PayPal requires the invoice parameter to be unique so if you have already sent an order ID with the same number, then it will be refused. Sending the same order ID can e.g. happen if you have two osCom shops linked to one PayPal account - the PayPal account cannot distinguish between different shops / domains / databases, it just looks at the number and says "hey, that's already been paid!"

 

There are two possible solutions:

 

 

******************************************

 

1. Create a unique invoice ID for each shop

this solution keeps the invoice ID check functionality but allows you to create unique IDs

 

Description:

If you have multiple shops linked to your PayPal account, then you get around this problem by adding a unique letter to your invoice parameter. As the invoice parameter can be any string (max length 127), it doesn't matter that it's not numeric. If you run several shops all with one PayPal account, then choose a different letter for each shop.

 

Note: this solution is for coders who have a reasonable knowledge of PHP. To alter your invoice parameter:

 

In /includes/modules/payment/paypal_ipn.php find this code:

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

 

and change to this:

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

 

choose any letter but keep it to ONE letter only!

 

 

 

In /ext/modules/payment/paypal/ipn.php just after

 

curl_close($ch);

}

 

add

 

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

 

and then replace all occurrences of

 

$_POST['invoice']

 

with

 

$invoice_id

 

(use a search / replace function if available)

 

 

The above code will add the letter to the order ID when sending to PayPal and then strip it back out again with the substr command. It's vital that you replace all occurences of the variable in ipn.php as otherwise your database update won't happen or be wrong.

 

I've tested it on my online shop and it's all working in Sandbox - I think it's a cleaner solution than just changing the order IDs to something higher as previously suggested. And it's also sustainable over time (think 10 years down the road when you have thousands of orders), plus even with just one letter you can run up to 26 different shops on one PayPal account.

 

******************************************

 

2. Disable the inoice ID checking

with this solution PayPal will not check for duplicate order IDs - a potential problem if customers e.g. hit a button twice. I'd recommend to try the first solution first, and only if that fails, try this second one:

 

In your PayPal account, go to "Profile" - > "Payment Receiving Preferences". In there you will have the option:

Block accidental payments:

You may prevent accidental payments by blocking duplicate invoice IDs

Yes, block multiple payments per invoice ID

No, allow multiple payments per invoice ID

 

Select "No".

 

PayPal will now allow all orders to be paid, even if the order ID has already been paid previously. A potential problem is if customers pay an invoice twice by mistake (e.g. refreshing browser, hitting button twice etc.).

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

a temporary solution switch on cod and place an order.

So next invoice ID will change.

 

else go thru what GERM has posted in the above comments.

 

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

That is weird because I only have one store linked to this account. And prior to reinstalling the software this worked like a champion now it has been error prone and a complete disaster. This occurs on both IPN and PAypal standard and even after order id is changed on the Oscommerce account.

Link to comment
Share on other sites

That is weird because I only have one store linked to this account. And prior to reinstalling the software this worked like a champion now it has been error prone and a complete disaster. This occurs on both IPN and PAypal standard and even after order id is changed on the Oscommerce account.

When I installed the IPN module I got the error and using this help text I fixed it.

 

But it was an older version (I installed in 2007).

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

  • 4 months later...

When I installed the IPN module I got the error and using this help text I fixed it.

 

But it was an older version (I installed in 2007).

 

This fix also worked for a similar problem I had with PayPal Standard. The coding is not exactly the same from IPN to standard in the respective files but the concept is there and I successfully made the adjustments to solve the issue for PayPal standard. FYI if someone using PayPal standard runs into this.

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

Also just a "FYI": I recently had a similar problem while testing in the sandbox. After combing this forum, somebody suggested checking in admin that the paypal email address was correct. In my case, I had the 'live' email address for the 'sandbox' switch. Silly me. Seems like this error message is a symptom with more than one cause, because, in my case, simply correcting the email address solved the problem. Hope this helps somebody else.

Link to comment
Share on other sites

  • 3 weeks later...

Also just a "FYI": I recently had a similar problem while testing in the sandbox. After combing this forum, somebody suggested checking in admin that the paypal email address was correct. In my case, I had the 'live' email address for the 'sandbox' switch. Silly me. Seems like this error message is a symptom with more than one cause, because, in my case, simply correcting the email address solved the problem. Hope this helps somebody else.

 

The above solution worked for me as well!

Contributions installed: Purchase without Account / STS/ All Products/ Header Tags Controller

Link to comment
Share on other sites

  • 1 month later...

The above solution worked for me as well!

I am getting this error with an install of a recent release.

 

I would like to change the invoice number to add a letter like the example at the top because we have 2 osc sites working with paypal, but the files have changed in 2.2RC2. There is no /includes/modules/payment/paypal_ipn.php anymore. ....and no reference to PayPal_IPN_ID in /ext/modules/payment/paypal/standard_ipn.php.

 

Please advise, ..I am going to try to do the COD thing in the meantime but adding a letter would be preferable.

 

Thanks

Link to comment
Share on other sites

  • 3 months later...

Whilst this could be an error with PayPal, I doubt it. I've seen it on 3 sites I've worked on and it's always come after add ons were used. The culprits were either CCGV or SSPC and in fairness it was neither's fault really - it was lousy manual adding as I've had both working fine on other sites.

 

I haven't yet pinned down exactly what it is but it's something in the final pages at checkout and I suspect it's to do with moving the order from the customer basket part of the database over to the order part or deleting the old customer basket so a new one is started on the next session. Customer then tries to reorder and sees this error.

 

At anyrate, I know that's no solution per se, yet the insight might help someone solve their problem.

Link to comment
Share on other sites

  • 3 months later...

What is CCGV and SSPC stand for? I'm getting this message as well, "This invoice has already been paid. Please contact Merchant." I have another post I've been trying to get help on in relation to this, but nobody has really piped up with any solution that works, so I wonder if this CCGV or SSPC might be at fault, or not, I don't know...

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...