Hello all.
Wondering if someone could offer any tips as to where I might be going wrong.
We're working with a retail bit of software but have been provided with some code to work with the new Worldpay XML integration.
Standard purchases work fine but ones that require 3D Secure do not. The logic process is this;
1 > Order send to WP
2 < Order comes back from WP with URL to 3D Secure page
3 > We send user there
4 < We receive a further message from WP with a key that we pass back on the final request (to confirm the card was authorised).
5 > We submit a final order via a second php call back script, with the XML and the cookie from the initial submission.
Our code for the first order is;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_FRESH_CONNECT,true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_POST,true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$xml);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, $merchantCode.":".$password);
curl_setopt($ch, CURLOPT_COOKIEJAR, "/home/path/dir/$invoiceID.cookie");
curl_setopt($ch, CURLOPT_TIMEOUT, 240);
$result_tmp = curl_exec ($ch);
if (curl_error($ch)) {
$result_tmp = "Curl Error: ".curl_errno($ch)." - ".curl_error($ch);
}
curl_close ($ch);
which works fine as the initial order comes back ok.
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_POST,true);
curl_setopt($ch, CURLOPT_POSTFIELDS,$xml);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_USERPWD, $merchantCode.":".$password);
curl_setopt($ch, CURLOPT_COOKIEFILE, "/home/path/dir/$invoiceID.cookie");
curl_setopt($ch, CURLOPT_TIMEOUT, 240);
$result_tmp = curl_exec ($ch);
if (curl_error($ch)) {
$result_tmp = "Curl Error: ".curl_errno($ch)." - ".curl_error($ch);
}
curl_close ($ch);
The cookiejar file is created by the first script and checking the atime of the file, can see it being read by something (assuming the second script).
WP report "Internal error! Could not find bean(s) in session cache." and when asked about it - they say that we're not sending back the cookie information.
I've tried numerous code changes and after a 10 hour stint - have gotten no where.
Any help is really appreciated. Thanks.
Matt