VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: alex2311 on October 15, 2022, 01:55:45 AM

Title: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: alex2311 on October 15, 2022, 01:55:45 AM
Hello,

When an order is paid for by PayPal the system is generating duplicate status updates. This includes sending emails as well for each repetition.  See below:
Friday, 14 October 2022 23:53   No   Pending   
Friday, 14 October 2022 23:54   Yes   Confirmed   Your payment for order 2N5A01543 has been confirmed by PayPal
Friday, 14 October 2022 23:56   Yes   Confirmed   Your payment for order 2N5A01543 has been confirmed by PayPal
Friday, 14 October 2022 23:58   Yes   Confirmed   Your payment for order 2N5A01543 has been confirmed by PayPal
Saturday, 15 October 2022 00:00   Yes   Confirmed   Your payment for order 2N5A01543 has been confirmed by PayPal
Saturday, 15 October 2022 00:02   Yes   Confirmed   Your payment for order 2N5A01543 has been confirmed by PayPal
Saturday, 15 October 2022 00:05   Yes   Confirmed   Your payment for order 2N5A01543 has been confirmed by PayPal
Saturday, 15 October 2022 00:10   Yes   Confirmed   Your payment for order 2N5A01543 has been confirmed by PayPal
Saturday, 15 October 2022 00:21   Yes   Confirmed   Your payment for order 2N5A01543 has been confirmed by PayPal
Saturday, 15 October 2022 00:42   Yes   Confirmed   Your payment for order 2N5A01543 has been confirmed by PayPal
Saturday, 15 October 2022 01:25   Yes   Confirmed   Your payment for order 2N5A01543 has been confirmed by PayPal
Saturday, 15 October 2022 02:50   Yes   Confirmed   Your payment for order 2N5A01543 has been confirmed by PayPal
Saturday, 15 October 2022 05:41   Yes   Confirmed   Your payment for order 2N5A01543 has been confirmed by PayPal

Any guidance on how to resolve the issue will be greatly appreciated.


VirtueMart 4.0.7 10718
Joomla 4.2.3
PHP 8.0

Regards,
Alex
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: GJC Web Design on October 15, 2022, 10:18:09 AM
can u check in your Paypal IPN history whether Paypal is sending multiple IPNs or check in your server logs for multiple IPNs
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: alex2311 on October 15, 2022, 14:27:39 PM
Thanks for looking into this anomaly  There are no duplicates in the IPN History...  See attached.

Cheers,
Alex
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: GJC Web Design on October 15, 2022, 17:20:24 PM
code wise it's hard to think of anything that would continuously trigger them - especially as it's every couple of seconds and then slowly increases the increment..

nothing in the server logs duplicating say the orderdone page or the return url of Paypal?

is this Standard Paypal or one of their endless variations/complications?
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: alex2311 on October 16, 2022, 03:43:24 AM
Just the standard PayPal plugin supplied with VM.  I just went through the IIS logs (Extract Below)...  Interesting.  For additional background.  We only recently upgraded to J4 which included a totally new template as the old one was incompatible.  I am not sure what to make of it.  It starts with a successful PUT call followed by a number of GET calls from random components, finishing with  PUT call that responds with a 500 code:

2022-10-14 13:54:12 X.X.X.X POST /index.php option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.paypal.com/ 200 0 0 1781
2022-10-14 13:54:12 X.X.X.X GET /media/vendor/awesomplete/css/awesomplete.css 1.1.5 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 200 0 0 46
2022-10-14 13:54:12 X.X.X.X GET /templates/shaper_helixultimate/css/presets/preset1.css - 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 200 0 0 62
2022-10-14 13:54:12 X.X.X.X GET /plugins/system/helixultimate/assets/css/system-j4.min.css - 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 200 0 0 93
2022-10-14 13:54:12 X.X.X.X GET /components/com_virtuemart/assets/css/vm-ltr-common.css vmver=c06609d9 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 200 0 0 93
2022-10-14 13:54:12 X.X.X.X GET /components/com_virtuemart/assets/css/vm-ltr-site.css vmver=c06609d9 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 200 0 0 93
2022-10-14 13:54:12 X.X.X.X GET /plugins/system/jce/css/content.css badb4208be409b1335b815dde676300e 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 200 0 0 93
2022-10-14 13:54:12 X.X.X.X GET /templates/shaper_helixultimate/css/template.css - 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 200 0 0 124
2022-10-14 13:54:12 X.X.X.X GET /plugins/system/jcemediabox/css/jcemediabox.min.css 0072da39200af2a5f0dbaf1a155242cd 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 200 0 0 124
2022-10-14 13:54:12 X.X.X.X GET /modules/mod_djimageslider/themes/default/css/djimageslider.css - 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 200 0 0 124
2022-10-14 13:54:12 X.X.X.X GET /templates/shaper_helixultimate/css/custom.css - 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 200 0 0 140
2022-10-14 13:54:12 X.X.X.X GET /templates/shaper_helixultimate/css/bootstrap.min.css - 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 200 0 0 249
2022-10-14 13:54:12 X.X.X.X GET /media/vendor/joomla-custom-elements/css/joomla-alert.min.css 0.2.0 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 200 0 0 249
2022-10-14 13:54:12 X.X.X.X GET /media/system/css/joomla-fontawesome.min.css 730997f91bb455ccdda3b6da6309c426 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 200 0 0 265
2022-10-14 13:54:12 X.X.X.X GET /media/vendor/jquery/js/jquery.min.js 3.6.0 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 200 0 0 109
2022-10-14 13:54:12 X.X.X.X GET /media/legacy/js/jquery-noconflict.min.js 04499b98c0305b16b373dff09fe79d1290976288 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 200 0 0 78
2022-10-14 13:54:13 X.X.X.X GET /media/system/js/core.min.js bea7b244e267b04087cedcf531f6fe827a8e101f 443 - 120.146.38.226 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/106.0.0.0+Safari/537.36+Edg/106.0.1370.42 https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy 200 0 0 78
2022-10-14 13:54:13 X.X.X.X POST /index.php option=com_virtuemart&view=vmplg&task=notify&tmpl=component&lang= 80 - 173.0.81.65 PayPal+IPN+(+https://www.paypal.com/ipn+) - 500 0 0 2750

Any thoughts?
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: GJC Web Design on October 16, 2022, 12:16:40 PM
there are a couple of other J4 users on here reporting this multi Paypal VM status trigger and therefore emails ...

But in your case below this is just gets for resources like css and images triggered by the single pluginresponsereceived call  -- though if u can find the 500 error in the logs might be interesting..

manually trying https://www.qld.raeme.org.au/index.php?option=com_virtuemart&view=vmplg&task=pluginresponsereceived&on=2N5A01543&pm=8&Itemid=519&PayerID=yyyyyyyyyyy just gives me the thank you page without any error..

but the IPN notification from Paypal would be url something like index.php?option=com_virtuemart&view=vmplg&task=notify&tmpl=component...  etc
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: ssc3 on October 16, 2022, 15:12:50 PM
Quote from: alex2311 on October 16, 2022, 03:43:24 AM
2022-10-14 13:54:13 X.X.X.X POST /index.php option=com_virtuemart&view=vmplg&task=notify&tmpl=component&lang= 80 - 173.0.81.65 PayPal+IPN+(+https://www.paypal.com/ipn+) - 500 0 0 2750

The last item in your log is the actual IPN from PayPal with a 500 status code.
PayPal will make up to 15 attempts to send an IPN. Each time increasing the interval between attempts, not stopping until it receives a 200 status code.

Quote from: GJC Web Design on October 15, 2022, 17:20:24 PM
Standard Paypal or one of their endless variations/complications?

If the IPN is failing you could try one of the PayPal variants as an alternative.

https://plugins.online-store.co.uk/paypal_express_checkout.html

This has the advantage of not requiring IPN's to confirm orders.
If you run this plugin with the shortcut option turned off, it will look to the customer just like PayPal Standard.

Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: jenkinhill on October 16, 2022, 15:49:11 PM
The current VM "default" PayPal plugin also has a switch to turn off IPN checking - "Check IPN provider IP"
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: alex2311 on October 16, 2022, 16:37:02 PM
GJC Web Design, thanks... Your right...  I am not seeing the " index.php?option=com_virtuemart&view=vmplg&task=notify&tmpl=component...".. which explains PayPal Retrying (maybe)

Thanks ssc3, If we can't resolve the default PayPal I may have a go at using it. Although you might be onto something with the 15 retries....  We are seeing 14 attempts.

Kelvyn,  That is the strange part.  Check IPN is already set to "No"

Cheers
Alex
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: ssc3 on October 16, 2022, 17:35:52 PM
"Check IPN provider IP" only checks if the IPN's IP address belongs to PayPal, but does not turn of the IPN itself.

PayPal Standard still needs to use the IPN to confirm the order.
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: jenkinhill on October 16, 2022, 17:49:44 PM
I don't use PayPal anymore, only Stripe, but when I did use PP it was with a plugin from plugins.online-store.co.uk with no problems.
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: GJC Web Design on October 16, 2022, 19:48:57 PM
QuoteThe last item in your log is the actual IPN from PayPal with a 500 status code.

indeed ... I didn't look hard enough ...  you need to find this fatal error .. is it logged on your sever errors or you can try installing Stans fatal catcher

https://www.rupostel.com/utilities-for-joomla/extensions/fatal-catcher-plugin  may work on J4
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: alex2311 on October 17, 2022, 00:18:19 AM
Thanks everyone for your input...  I always struggle finding the source of the ever helpful 500 errors!...  LOL.  I will see how I go.


Cheers
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: Darko F. on October 18, 2022, 10:29:05 AM
I get this problem today
Our customer realy use Paypal, but today we get one order and 7 email with confirmation was send to customer and seven email on our email box
I disable PayPal plugin.
Joomla 3 with com_virtuemart.4.0.7.10718_package_or_extract.zip

I istall now

com_virtuemart.4.0.7.10720_package_or_extract.zip

but I didnt enable paypalI will done some testing.

Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: Darko F. on October 18, 2022, 11:03:08 AM
Even after instaling Joomla 3 with
com_virtuemart.4.0.7.10720_package_or_extract.zip

and disabled plugin, even order we change to pending still sending emails every ten minutes one. I will disable system joomla email if this will continue. Dont know what to do at this point
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: GJC Web Design on October 18, 2022, 16:24:08 PM
It could be something like the IPN call from Paypal to your server doesn't return a 200 so Paypal keeps sending IPNs

is it php version related?  which version? maybe 8+ ?

try and see if there is a 500 error or 403 error etc in the logs for a call of   index.php option=com_virtuemart&view=vmplg&task=notify&tmpl=component
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: alex2311 on October 19, 2022, 00:10:31 AM
I ended up taking Kelvyn's advice:
"I don't use PayPal anymore, only Stripe, but when I did use PP it was with a plugin from plugins.online-store.co.uk with no problems."

Installing the basic version of the PayPal version resolved my issue. 

I tried the debugging tool suggested by GJC Web Design but it did not like Joomla 4 (crashed the site) and sent me 450 emails. :-(

Thanks all.
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: Darko F. on October 19, 2022, 00:31:10 AM
I changed plugin to sandbox and these seems stooping emails fro sending.
I call customer apologise for flooded his email box, and for now I will not touch papal plugin a while.
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: Milbo on October 28, 2022, 00:09:38 AM
I really wonder about this. You are both on j4? and the problem appears with the plugin of vm and the one of onlinestore? or just with the one of the core?
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: alex2311 on October 29, 2022, 11:26:53 AM
Hi Milbo,

I can setup a duplicate test site if you wish to look at it in more detail.  At the moment we a re running with a different PayPal plugin which has solve the problem.

Cheers
Alex
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: Darko F. on October 29, 2022, 21:05:05 PM
Hi
It hapen joomla 3 and core Paypal plugin,
on virtuemart i think : com_virtuemart.4.0.7.10722_package_or_extract.zip

But I don't touch PayPal anymore with none of my shops, even because their 2500€ fine for someone who doesn't agree with their ideological stance. I don't care  what stance they have, and I don't care about politic, I'm just strongly ageist private company fine you for their imaginary reason when they want, In my opinion this is dangerous precedents and there are a loot of others payment processors to choose with better terms and conditions.
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: p.barg on January 11, 2023, 09:07:51 AM
Hello,

we've ran into the same problem now. Migrated a site from J3/VM3 PHP7.4 to J4/VM4 PHP8.0.
For an order paid with PayPal we get tons of order confirmation (with status "changes" from confirmed to confirmed) and corresponding e-mails (to vendor and customer).
Has anybody found any fix/solution to this by now? Maybe i'ts just a matter of configuration?

Thanks and regards,

Petra
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: alex2311 on January 11, 2023, 10:00:44 AM
Hi Petra,

I didn't find a solution...  As I said above...
QuoteI ended up taking Kelvyn's advice:
"I don't use PayPal anymore, only Stripe, but when I did use PP it was with a plugin from plugins.online-store.co.uk with no problems."

Installing the basic version of the PayPal version resolved my issue.

I tried the debugging tool suggested by GJC Web Design but it did not like Joomla 4 (crashed the site) and sent me 450 emails. :-(

Thanks all.

Out of curosity...  Is it hosted on IIS server?   

Cheers
Alex
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: p.barg on January 11, 2023, 11:21:20 AM
Hi Alex,

thanks for your reply. The site is hosted on an Apache Server.
In the past I've been using one of the paypal plugins by online-store.co.uk and was quite happy. So I'll probably give that a try.
Do you use the paypal express checkout plugin by them? Or did you give up PayPal completely?

Best regards,

Petra
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: alex2311 on January 11, 2023, 14:02:45 PM
I use:

PayPal Checkout SSC (1.4.17) Free Version

Virtuemart Payment Plugins
PayPal Checkout (New Version) : Use's PayPal's latest SDK to present a range of payment options to your buyers based on their geographical location.

It works well for us!

Alex

PS... I was curious if the fault we were experiencing related to the hosting environment...  It seems to be only occurring to a few of us....
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: p.barg on January 27, 2023, 09:44:33 AM
I now followed an advise in the German forum (bei Stefan): in the backend of the PayPal plugin set "Successful status restriction via IPN" to "Pending". This way status is only changed once to "confirmed" and only
1 mail gets sent.
What is still missing though is the PayPal transaction details that are normally listed in the payment section of the order.

-- Petra

The link to the German forum thread: https://forum.virtuemart.de/thread/3614-10-gleiche-best%C3%A4tigungsmail-nach-paypal-bezahlung/?postID=18185&highlight=paypal#post18185
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: alex2311 on January 28, 2023, 03:59:45 AM
I guess that is progress... ? It is still strange behaviour.
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: Alexb65 on February 01, 2023, 14:27:21 PM
Hi all

We were plagued with this bug and developed a small fix (Joomla 4.2.6 VM 4.0.12)

The problem has to be catched in function plgVmOnPaymentNotification in file plugins/vmpayments/paypal/paypal.php

Here is the fix to avoid multiple changes in status and notifications only when an order is already in C state (for us C is Confiermed after payment)

[code[
764         function plgVmOnPaymentNotification() {
.....
793                 $order = $orderModel->getOrder($virtuemart_order_id);
    794 /****** FIX multiple notification ****/
    795
    796                 $test = $order['details']['BT'];
    797
    798                 // if order status is already accepted then exit : dirty hack to multiple email
    799                 error_log(__FILE__ ." " . __LINE__ . " order  $order_number status  " . $test->order_status .
    800                                 " PAYPAL status = " . $paypal_data['payment_status']
    801                                 );
    802                 if ( $paypal_data['payment_status'] === "Completed" &&
    803                         $test->order_status ==="C") {
    804                         error_log ("spurious paypal notification discarded for order ID $order_number");
    805                         return false;
    806                 }
    807
    808 /************ END FIX *********************/
   809
810                 $this->_currentMethod->payment_currency = $this->getPaymentCurrency($this->_currentMethod,$order['details']['BT']->payment_currency_id);

[/code}

You may avoid the error_log part if not interested

Hope this helps
Title: Re: Duplicate Status Updates for orders using PayPal with multiple matching Emails
Post by: p.barg on June 12, 2023, 11:07:17 AM
Hello all,

can someone from the devs confirm that these PayPal problems are resolved in the current VM version (4.0.20)?
I just want to make that sure, before I update any further customer sites...

Petra