News:

Support the VirtueMart project and become a member

Main Menu

[SOLVED] PayPal IPN 403 error with SEF

Started by optmax, September 16, 2013, 11:41:32 AM

Previous topic - Next topic

optmax

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!

alatak

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'),

optmax

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.

alatak

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',

optmax

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

alatak


optmax

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.

alatak

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',

optmax

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

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

Maxim Pishnyak

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.
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

optmax

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.

alatak

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

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

optmax


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.

Maxim Pishnyak

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?
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

optmax

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