VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: optmax on September 16, 2013, 11:41:32 AM

Title: [SOLVED] PayPal IPN 403 error with SEF
Post by: optmax on September 16, 2013, 11:41:32 AM
Joomla 2.5.14
VM 2.0.22c

SOLVED
Rule in my .htaccess was redirecting the PayPal notification
See reply #14 in this thread

When I have Joomla standard SEF on  I get no PayPal confirmation IPN.
The PayPal Notification URL is:
http://mysite/component/virtuemart/pluginresponse/pluginnotification?tmpl=component
with response code 403.

With SEF off the IPN confirmation is received correctly.
The PayPal Notification URL is
http://mysite/index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component
with response code 200.

I would prefer to have SEF on so is there anything I should be doing?

The problem started about a week ago on September 6th.  That may be the day when I installed VM 2.0.22c but i am not sure!
Title: Re: PayPal IPN 403 error with SEF
Post by: alatak on September 16, 2013, 12:06:25 PM
Hello

Can you try to change in file vmpayment/paypal/paypal.php
line 213
replace
"notify_url"       => substr(JURI::root(false,''),0,-1) . JROUTE::_('index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component', false),

by
  "notify_url"       => substr(JURI::root(false,''),0,-1) . JROUTE::_('index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component'),
Title: Re: PayPal IPN 403 error with SEF
Post by: optmax on September 16, 2013, 12:59:15 PM
Hi Alatak
Thanks for the quick reply.

I have tried what you suggest but it has made no difference - still no confirmed IPN with SEF on.
Title: Re: PayPal IPN 403 error with SEF
Post by: alatak on September 16, 2013, 13:22:11 PM
Hello
ok , try to replace with this line then

  "notify_url"       => substr(JURI::root(false,''),0,-1) . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component',
Title: Re: PayPal IPN 403 error with SEF
Post by: optmax on September 16, 2013, 13:59:21 PM
Hello
This time no confirmation IPN at all with or without SEF.

Also there was no response code in the IPN history for either setting
Title: Re: PayPal IPN 403 error with SEF
Post by: alatak on September 16, 2013, 14:05:25 PM
Hello

Is your website in a folder?
Title: Re: PayPal IPN 403 error with SEF
Post by: optmax on September 16, 2013, 14:16:29 PM
Hello

I have a development site in a folder but this is getting no IPN confirmations at all.

So this morning  I have been using my live site in public_html with an additional PayPal payment method configured to use a sandbox account.
Title: Re: PayPal IPN 403 error with SEF
Post by: alatak on September 16, 2013, 15:50:13 PM
Hello

QuoteI have a development site in a folder but this is getting no IPN confirmations at all.
If you have your website in a subfolder , try that by hardcoding the URL of your website to understand if that is the reason.

  "notify_url"       => YOURWEBSITEURLS+SUBFOLDER .  'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component',
Title: Re: PayPal IPN 403 error with SEF
Post by: optmax on September 16, 2013, 23:31:10 PM
Hello again Alatak

I am sorry to have wasted so much of your time earlier today, but I can now report that it was a problem with my .htaccess file (a version of the 'Joomla suggested Master htaccess' found here http://docs.joomla.org/Htaccess_examples_%28security%29 (http://docs.joomla.org/Htaccess_examples_%28security%29)

Re-installing the default .htacess that comes with VM and putting the line 213 code back to its original and I am receiving confirmation IPNs with and without SEF.

I don't know which part of my .htaccess was causing the problem but it had worked until just over a week ago!  I will investigate further....

(On a different matter as discussed elsewhere in the forums I do continue to get duplicate PayPal orders in the backend...)
Title: Re: PayPal IPN 403 error with SEF
Post by: Maxim Pishnyak on September 17, 2013, 10:03:26 AM
Quote from: optmax on September 16, 2013, 23:31:10 PM
(On a different matter as discussed elsewhere in the forums I do continue to get duplicate PayPal orders in the backend...)
Members of VM Team already posted about this issue. You just didn't search deeply on forum. This is paypal issue and it's not easy to find workaround about it.
Title: Re: PayPal IPN 403 error with SEF
Post by: optmax on September 17, 2013, 11:53:02 AM
Quote from: Maxim Pishnyak on September 17, 2013, 10:03:26 AM
Quote from: optmax on September 16, 2013, 23:31:10 PM
(On a different matter as discussed elsewhere in the forums I do continue to get duplicate PayPal orders in the backend...)
Members of VM Team already posted about this issue. You just didn't search deeply on forum. This is paypal issue and it's not easy to find workaround about it.

Maxim
Thanks for the input.  I did say '.. as discussed elsewhere in the forums..'

As you say it could be a PayPal issue and a Google search does show other shopping carts with similar problems BUT these seem to be sporadic whereas with VM every PayPal order is duplicated.
Title: Re: PayPal IPN 403 error with SEF
Post by: alatak on September 17, 2013, 12:16:40 PM
Hello

Quote
Quote from: optmax on September 16, 2013, 23:31:10 PM
Hello again Alatak

I am sorry to have wasted so much of your time earlier today, but I can now report that it was a problem with my .htaccess file (a version of the 'Joomla suggested Master htaccess' found here http://docs.joomla.org/Htaccess_examples_%28security%29 (http://docs.joomla.org/Htaccess_examples_%28security%29)

Good that you found out.

QuoteRe-installing the default .htacess that comes with VM and putting the line 213 code back to its original and I am receiving confirmation IPNs with and without SEF.
which line it is exactly ? i have copy/pasted the file from the link you gave, but line 213 is a comment
Title: Re: PayPal IPN 403 error with SEF
Post by: optmax on September 17, 2013, 19:02:14 PM

QuoteRe-installing the default .htacess that comes with VM and putting the line 213 code back to its original and I am receiving confirmation IPNs with and without SEF.
which line it is exactly ? i have copy/pasted the file from the link you gave, but line 213 is a comment
[/quote]

I reinstated the default .htaccess and reinstated the original code in Line 213 of paypal.php

Sorry for the confusion.

I have not yet tracked down which part of the 'Suggested Joomla Master .htaccess' causes the problem.  My guess is I need to add a rule in the
########## Begin - Advanced server protection rules exceptions ####
section for the file with the IPN listener but I am not sure which file this is.
Title: Re: PayPal IPN 403 error with SEF
Post by: Maxim Pishnyak on September 17, 2013, 19:43:52 PM
Quote from: optmax on September 17, 2013, 11:53:02 AM
As you say it could be a PayPal issue and a Google search does show other shopping carts with similar problems BUT these seem to be sporadic whereas with VM every PayPal order is duplicated.
Maybe it was htaccess issue or something else?
Title: Re: PayPal IPN 403 error with SEF
Post by: optmax on September 17, 2013, 23:11:19 PM
Have tracked down the offending rule in my .htaccess
## Disallow visual fingerprinting of Joomla! sites (module position dump)
## Initial idea by Brian Teeman and Ken Crowder, see:
## http://www.slideshare.net/brianteeman/hidden-joomla-secrets
## Improved by @nikosdion to work more efficiently and handle template
## and tmpl query parameters
RewriteCond %{QUERY_STRING} (^|&)tmpl=(component|system) [NC]
RewriteRule .* - [L]
RewriteCond %{QUERY_STRING} (^|&)t(p|emplate|mpl)= [NC]
RewriteRule .* - [F]


Because (at line 213 of paypal.php) JROUTE returns tmpl=component within the QUERY_STRING, both of these RewriteCond are true as the Notification URL sent to PayPal is set to
http://mysite/component/virtuemart/pluginresponse/pluginnotification?tmpl=component

To keep these rewrites I would need to turn VM SEO off (leaving Joomla SEF on).



Title: Re: [SOLVED] PayPal IPN 403 error with SEF
Post by: alatak on September 18, 2013, 08:47:37 AM
Hello

@optmax
Really interesting what you found.
Thank you.

i will see if something can be done.
Title: Re: [SOLVED] PayPal IPN 403 error with SEF
Post by: AH on September 18, 2013, 10:34:44 AM
At the top of the joomla page it does state that using the advanced server .htaccess will cause problems with VM.  Clearly the base installed version does not.

http://docs.joomla.org/Htaccess_examples_%28security%29 (http://docs.joomla.org/Htaccess_examples_%28security%29)

QuoteYou are ultimately responsible for disabling sections or writing exception rules for legitimate requests that fail. Most notably, the advanced server protection section will cause issues with several minifiers, eXtplorer, VirtueMart and other extensions which use non-standard scripts as their entry points. You must add exceptions manually to the proper area of the file.

If Alatak can propose a mod exception setting then this might be a solution for those wishing to use this version of .htaccess, however much other testing might be needed as the author gives little further indication as to the VM "issues".

Title: Re: [SOLVED] PayPal IPN 403 error with SEF
Post by: alatak on September 18, 2013, 10:39:34 AM
Hello

Yes Hutson you are rigth. I read that also
Quote...VirtueMart and other extensions which use non-standard scripts as their entry points

i do not know what they mean by "non-standard"
I am contacting the author to have more information.