Forum Moderators: coopster

Message Too Old, No Replies

HSBC CPI integration with PHP

Having a lot of trouble with this...

         

vincevincevince

12:55 pm on Jun 1, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

I've not had experience with HSBC CPI before, and am trying to integrate a shopping cart with it.

The server is Linux/Apache, and I have coded the cart in PHP. I'm desperately hoping that someone can give me a few pointers on what to do here, especially regarding the POST statements.

ajimenez

2:56 pm on Aug 5, 2004 (gmt 0)

10+ Year Member



does your host run php in safe mode?

luigi_uk

8:20 pm on Aug 5, 2004 (gmt 0)

10+ Year Member



Does the file 'libCcCpitools.so' have to be installed in my WEB-INF/lib folder or the servers /lib folder?
Can the TestHash.e file live anywhere? Ive put mine in the cgi-bin folder.

I cant seem to execute the TestHash.e file plus it doesnt report an error.
<?
$path='/home/virtual/site66/fst/var/www/cgi-bin';
$cmd="$path/TestHash.e CPIHASHKEY $str";
$ret=exec($cmd);
$ret=split(':',$ret);
//Returns the hash
$hash=trim($ret[1]);
return $hash;
?>

I have tested whether the file exists in its path and it does.

Please help.

crypto

5:17 am on Aug 6, 2004 (gmt 0)

10+ Year Member



Hi guys,

I finally got the TestHash.e working. The problem was that I was passing a junk encrypted key as the argument. But I wasn't getting an error message either. I had to check the exit status with the system() function to get to the root of the problem. Anyway thanx everyone for the help. First hurdle is over, now moving onto the next one :)

crypto

5:25 am on Aug 6, 2004 (gmt 0)

10+ Year Member



Hi luigi_uk,

libCcCpiTools.so has to be put in /usr/lib on the server.

And make sure "TestHash.e" has execute permissions(chmod 755) and it has to be uploaded in binary mode(via ftp)

Also I hope you are not making the same mistake as I did that is you need to pass the actual CPIHASHKEY to TestHash.e and not any junk value.

rossriley

5:54 am on Aug 6, 2004 (gmt 0)

10+ Year Member



Hi guys,
I'm going through this same process with HSBC. I've got as far as sending the details to the cpi servlet but every time I just get bounced back to my return page with a Cpi Code of 4 which according to their integration pack means the server gave no response.
Incidentally, nothing is getting sent to the results url either.

Has anyone come across this yet?

crypto

6:55 am on Aug 6, 2004 (gmt 0)

10+ Year Member



Hi Rossriley,

Are you through with the generation of the Order Hash Key?
Check that there could be a problem in the generation.

rossriley

7:53 am on Aug 6, 2004 (gmt 0)

10+ Year Member



Yes i've got the hash generation working ok.
HSBC are returning immediately to my return url with their POST which includes an order hash and the CpiResultsCode. This code is always 4
I can verify their returned order hash and it is fine, just this error code which doesn't really explain anything.

Ross

ajimenez

8:07 am on Aug 6, 2004 (gmt 0)

10+ Year Member



Have u made sure that you're sending the timestamp in ms?

ie

$timestamp=time();
$timestamp*=1000;

rossriley

8:30 am on Aug 6, 2004 (gmt 0)

10+ Year Member



Thanks ajimenez
That was it, i wasn't multiplying by 1000!
Was i glad to see the hsbc site!

carneddau

11:03 am on Aug 6, 2004 (gmt 0)

10+ Year Member



"Was i glad to see the hsbc site!"

:) Same here, I've never been so pleased to see a web page. It took me a few days to get the POST sending all of the correct values to the servlet. It's not helped by poor documentation and a lack of support for people approaching this using a scripting language.

This 92 message thread spans 10 pages: 92