Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Sage pay Server


7 replies to this topic

#1 DamanC

  • Community Member
  • 123 posts
  • Real Name:Daman

Posted 26 May 2011, 17:43

Sorry to post this in here but hopefully this may give me something more to play with.

I'm having issues integrating sage pay server into OSC and have hit a brick wall : http://forums.oscommerce.com/topic/375636-sage-pay-server-error-5006/

This issue is sage pay rejects an order because it receives no response from the 'notifcation URL'.

The URL is

notificationurl=https://www.mydomain.co.uk/checkout_process.php?check=SERVER&osCsid=07859e3396eba48a966ab5164f53296a

and is generated from a bit of code in the sage_pay_server.php file;

            if ( MODULE_PAYMENT_SAGE_PAY_SERVER_PROFILE_PAGE == 'Normal' ) {
              $error_url = tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . (tep_not_null($error) ? '&error=' . $error : '') . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);
            } else {
              $error_url = tep_href_link('ext/modules/payment/sage_pay/redirect.php', 'payment_error=' . $this->code . (tep_not_null($error) ? '&error=' . $error : '') . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);
            }

            $result = 'Status=OK' . chr(13) . chr(10) .
                      'RedirectURL=' . $error_url;
          } else {
            $result = 'Status=OK' . chr(13) . chr(10) .
                      'RedirectURL=' . tep_href_link(FILENAME_CHECKOUT_PROCESS, 'check=PROCESS&key=' . md5($sage_pay_server_securitykey) . '&VPSTxId=' . $HTTP_POST_VARS['VPSTxId'] . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);
          }
        } else {
          tep_session_unregister('sage_pay_server_securitykey');
          tep_session_unregister('sage_pay_server_nexturl');

          $error = $this->getErrorMessageNumber($HTTP_POST_VARS['StatusDetail']);

          if ( MODULE_PAYMENT_SAGE_PAY_SERVER_PROFILE_PAGE == 'Normal' ) {
            $error_url = tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . (tep_not_null($error) ? '&error=' . $error : '') . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);
          } else {
            $error_url = tep_href_link('ext/modules/payment/sage_pay/redirect.php', 'payment_error=' . $this->code . (tep_not_null($error) ? '&error=' . $error : '') . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);
          }

          $result = 'Status=INVALID' . chr(13) . chr(10) .
                    'RedirectURL=' . $error_url;
        }

        echo $result;

with particular attention to

'RedirectURL=' . tep_href_link(FILENAME_CHECKOUT_PROCESS, 'check=PROCESS&key=' . md5($sage_pay_server_securitykey) . '&VPSTxId=' . $HTTP_POST_VARS['VPSTxId'] . '&' . tep_session_name() . '=' . tep_session_id(), 'SSL', false);


I'm not entirely convinced my notification URL should contain
amp;
can anyone see or think why it might be?


Also, is there anything I can change to perhaps make the redirect/notification url static such as 'checkout_success.php? I'm no Guru but have fuffed about with it for ages but don't know the correct syntax.

Appreciate your time :)

#2 achieve

  • Community Member
  • 37 posts
  • Real Name:Declan Connolly

Posted 10 December 2011, 22:58

Did you ever get anywhere with this? I am having similar problem. Being trying to resolve for days but no success yet. Lots of post on the forum but no real solution yet.

#3 HuskyDog

  • Community Member
  • 34 posts
  • Real Name:Ian Beadle

Posted 11 December 2011, 01:18

I think that a temporary solution to this may be to go to the html_output file and change:

$link = str_replace('&', '&', $link);
to
$link = str_replace('&', '&', $link);

Be aware that this is hardly ideal as it invalidates the code, (& did not start a character reference (& probably should have been escaped as &).

I'm hoping that someone will have a better solution though, as this is not the best way to do this.

#4 HuskyDog

  • Community Member
  • 34 posts
  • Real Name:Ian Beadle

Posted 11 December 2011, 03:40

I have been searching online for some info on "PHP backspace" and this seems the way to remove the & from what I can find out. However, I am no great PHP programmer, and don't know how to implement this to get it to work.

#5 achieve

  • Community Member
  • 37 posts
  • Real Name:Declan Connolly

Posted 11 December 2011, 14:00

I'm using Ultimate SEO URLs v2.2d , so that particular piece of code doesn't exist in includes/functions/html_output.php

#6 achieve

  • Community Member
  • 37 posts
  • Real Name:Declan Connolly

Posted 11 December 2011, 22:12

Although no solution yet, I have just now completed a new clean install of OSC 2.3.1 and am still receing the 5006 error. Will I ever get this sorted?

#7 HuskyDog

  • Community Member
  • 34 posts
  • Real Name:Ian Beadle

Posted 16 December 2011, 02:31

You can use the .htaccess file to change the the url from& to & which should solve your problem.

Add this to your .htaccess file:

RewriteCond %{QUERY_STRING} ^(.*)&(.*)$
RewriteRule ^(.*)$ /$1?%1&%2 [L,R=301]

I hope this helps.

Best regards,

Ian

#8 achieve

  • Community Member
  • 37 posts
  • Real Name:Declan Connolly

Posted 16 December 2011, 09:26

No joy with that either I'm afraid, but thanks for the suggestion. THink I will just use a different payment processor. Too many problems with Sagepay.