I have had someone run a test purchase through my live site.
They have been diverted off to Worldpay, but once they have paid, the Order Status still shows as 'In Checkout' and that no payment has been taken.

Comments

GavinC’s picture

Priority: Normal » Critical

I have had a response from Worldpay stating there is no server side script at /cart/worldpay/complete

Can you help asap?

alanburke’s picture

If you call
http://YOURSITE.com//cart/worldpay/complete

Do you get anything on screen?

Alan

bloke_zero’s picture

Whenever I type that in I get:

There was an error with the transaction. The host did not match.

At the moment in test mode sometimes the transaction goes through and sometimes it fails. It all ways works for me (mac firefox 3 / safari) and always fails for my co-developer in another location coming up with that error message.

Need to go live ad only just discovered the problem - any thoughts?

alanburke’s picture

Odd.

The

There was an error with the transaction. The host did not match.

just means that the script is at the address and is working.
The error means the request isn't coming from the Worldpay servers and it won't process it.
It stops people from faking a response to your server.

Ask Worldpay for any errors that they are seeing.
Is the IP address resolving properly for them.
Is your server suffering downtime?

Alan

bloke_zero’s picture

Hi Alan,

Thanks for your response.

The issue for me is the system works perfectly for me, but when a couple of other people tested it it came back with the response above. As a test I removed the lines:

  if ($_SERVER['HTTP_HOST'] != $_POST['M_http_host']) {
     print t('There was an error with the transaction. The host did not match.');
     exit();
   }

And the transaction was completed successfully (obviously this will have security implications so isn't a 'fix').

I would suggest that those lines are catching genuine transactions as well as fake ones. I don't think it's a problem at the Worldpay end as there aren't any issues until they try to return to the site and the transaction is completed as far as they are concerned (I get the authorized transaction email from them).

Also they authorized the site, so perhaps like me, they aren't seeing the error?

It couldn't be anything to do with their recent re-branding as RBS Worldpay could it?

Thanks

Alex

alanburke’s picture

Ok
I looked through the code again.
That piece of code tests that the server that sent the request to Worldpay
is the same server now processing the response from Worldpay

So when processing an order,
there isn't actually a test that it comes from the Worldpay server.
See #367935: Ideas for improvement

One possibility is that the order is being created on
example.com [no www]
and the response is sent to
www.example.com/cart/worldpay/complete [with www].

See it that is causing the issue.
If it is, you can modify the .htaccess file to make the www version the canonical
See the .htaccess file in the root of your drupal installation.

Regards
Alan

bloke_zero’s picture

Hi Alan,

that sounds logical! I'll check it out and report back.

Thanks

Alex

bloke_zero’s picture

That was indeed the problem, making www. appear in the URL fixed it - should have known, it's not the first time I've had that sort of problem.

Thanks

alanburke’s picture

Status: Active » Fixed

Good stuff.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.