Forum Moderators: coopster

Message Too Old, No Replies

HSBC integration problem

         

chemzoo

5:56 am on Mar 11, 2005 (gmt 0)

10+ Year Member



Hello all,

I had gone through the topic about hsbc integration, and i tried out everything, but i am not getting the payment integration working. I have a form like this

<form name="checkout_confirmation" action="https://www.cpi.hsbc.com/servlet" method="post">
<input type="hidden" name="CpiDirectResultUrl" value="https://www.secure.check.com/checkout.php">
<input type="hidden" name="CpiReturnUrl" value="https://www.secure.check.com/checkout.php">
<input type="hidden" name="OrderDesc" value="Test 101">
<input type="hidden" name="PurchaseAmount" value="950">
<input type="hidden" name="PurchaseCurrency" value="826">
<input type="hidden" name="StorefrontId" value="<?=$storeid;?>">
<input type="hidden" name="TimeStamp" value="1110442974000">
<input type="hidden" name="TransactionType" value="Auth">
<input type="hidden" name="MerchantData" value="<?=$test;?>">
<input type="hidden" name="BillingAddress1" value="address1">
<input type="hidden" name="BillingCity" value="city">
<input type="hidden" name="BillingCountry" value="352">
<input type="hidden" name="BillingCounty" value="">
<input type="hidden" name="BillingFirstName" value="firstname">
<input type="hidden" name="BillingLastName" value="lastname">
<input type="hidden" name="BillingPostal" value="00000">
<input type="hidden" name="ShopperEmail" value="test@test.com">
<input type="hidden" name="ShippingAddress1" value="shipaddr1">
<input type="hidden" name="ShippingCity" value="shipcity">
<input type="hidden" name="ShippingCountry" value="352">
<input type="hidden" name="ShippingCounty" value="">
<input type="hidden" name="ShippingFirstName" value="shipfirst">
<input type="hidden" name="ShippingLastName" value="shiplast">
<input type="hidden" name="ShippingPostal" value="00000">
<input type="hidden" name="Mode" value="T">
<input type="hidden" name="OrderHash" value="<?=$hashvalue;?>">
<input type="submit" value="Pay now(working)"></form>

The orderhash and the storefrontid are the values got from hsbc. But i get result from hsbc page as Communication Failure. The CpiDirectResultUrl and CpiReturnUrl are test pages. I have seen hsbc modules for oscommerce, but this is not a shopping cart, i only want to integrate HSBC

badone

10:41 am on Mar 11, 2005 (gmt 0)

10+ Year Member



But i get result from hsbc page as Communication Failure.

This appears to be an indication that it does not recognise any of the variables you are passing to it and, sure enough, if you go directly to [cpi.hsbc.com...] in your browser you get the same error.

I suspect you need to change method="get" in your <form> tag.

HTH,
BAD

chemzoo

5:02 am on Mar 12, 2005 (gmt 0)

10+ Year Member



I found out the mistake in "communication failure", it's because CpiReturnUrl was case sensitive and i mis-spelled. Now i am able to go to HSBC site, but i am getting Result code: 4, which is "The processor did not return a response."

I have done

$cmd="$path/TestHash.e HASHKEY $str"; // $str contains all hidden variables

$ret=exec($cmd);
$ret=split(':',$ret);
$hash=trim($ret[1]);

But i am not getting any value now on $hash. Anyone know how to to execute TestHash.e and get value for $hash?

hughie

12:48 pm on Mar 12, 2005 (gmt 0)

10+ Year Member



I think this is a problem in your data that your creating the hash key with. Get in touch with the help at HSBC and pass them the string you are using to create the hash, they will create the hash on their end using the same string. If there is a difference then you know its on your end.

Cheers,
hughie

hughie

12:56 pm on Mar 12, 2005 (gmt 0)

10+ Year Member



This is my hash generation

function generate_hash()
{
$c_files_path="/home/mysitefiles/hsbcbits/";
$merchantData=$_SESSION[sessionid];
$themode='T';
$GLOBALS[orderdesc]='blah';
$GLOBALS[ordertotal]=($this->ordertotal)*100;
$orderid=$this->orderid;
$ordercurrency=826;
$storeid='UK300000000GBP';
$timestamp=time()*1000;

$transaction_type='Auth';
$userid='userid';

$cmd=$c_files_path.'TestHash.e MYHASHKEYjkshdjkasdb "https://secure.site.com/order_result.php" "https://secure.site.com/order_complete.php" "'.$_SESSION[sessionid].'" "T" "'.$GLOBALS[orderdesc].'" "'.$orderid.'" "'.$GLOBALS[ordertotal].'" "826" "UK00101000GBP" "'.$timestamp.'" "Auth" "userid" ';
$ret=exec($cmd);
$ret=split(':',$ret);

//Returns the hash
$hash=trim($ret[1]);
return $hash;
}

hughie

12:58 pm on Mar 12, 2005 (gmt 0)

10+ Year Member



my post form

<form name="cpiForm" method="POST" action="https://www.cpi.hsbc.com/servlet">
<INPUT type="hidden" size="80" name="CpiDirectResultUrl" value="https://secure.mysite.com/order_result.php">
<INPUT type="hidden" size="80" name="CpiReturnUrl" value="https://secure.mysite.com/order_complete.php">
<INPUT type="hidden" size="80" name="MerchantData" value="'.$_SESSION[sessionid].'">
<INPUT type="hidden" size="80" name="Mode" value="T">
<INPUT type="hidden" size="80" name="OrderDesc" value="'.$GLOBALS[orderdesc].'">
<input type="hidden" name="OrderHash" value="'.$GLOBALS[orderhash].'">
<input type="hidden" name="OrderId" value="'.$GLOBALS[orderid].'">
<INPUT type="hidden" size="80" name="PurchaseAmount" value="'.$GLOBALS[ordertotal].'">
<INPUT type="hidden" size="80" name="PurchaseCurrency" value="826">
<INPUT type="hidden" size="80" name="StorefrontId" value="UK0000000GBP">
<INPUT type="hidden" size="80" name="TimeStamp" value="'.$GLOBALS[timestamp_new].'">
<INPUT type="hidden" size="80" name="TransactionType" value="Auth">
<INPUT type="hidden" name="UserId" value="userid">
<input type="submit" value="PROCEED TO HSBC" class="submit">
</form>

chemzoo

6:17 am on Mar 14, 2005 (gmt 0)

10+ Year Member



libCcCpiTools.so
is this installation necessary ,if yes where to install and how to do it.

hughie

1:05 pm on Mar 14, 2005 (gmt 0)

10+ Year Member



yeah, you need to put that on your server, somewhere like /usr/lib/LibCc....

i'm not unix guru so i just stuck it there and it seemed to work ;-)

chemzoo

2:22 pm on Mar 14, 2005 (gmt 0)

10+ Year Member



yeah, you need to put that on your server, somewhere like /usr/lib/LibCc....

i'm not unix guru so i just stuck it there and it seemed to work ;-)

I don't have access to lib directory, is it necessary to put in that directory itself?

plz chk _SERVER["PATH"] in phpinfo, is /usr/lib one of the path in that

when i used phpinfo(), the directory usr/bin was showing in _SERVER["PATH"]. Was it the same for you?

hughie

6:31 pm on Mar 14, 2005 (gmt 0)

10+ Year Member



you need to stick it in the Lib Directory, ask your host to stick it there if you don't have access.

cheers,
hughie

chemzoo

5:52 am on Mar 15, 2005 (gmt 0)

10+ Year Member



Thanks for your reply, but what i wanted to know is that when when i used phpinfo(), the directory usr/bin was showing in _SERVER["PATH"]. Was it the same for you?
Can you plz chk _SERVER["PATH"] in phpinfo, is /usr/lib the filepath it's showing?

I tried the hash generation in my local systems which is running in windows. I put the .dll file in the paths in _SERVER["PATH"] (not in lib dir) and it worked and tht is the reason why i asked to check the server path

hughie

8:34 am on Mar 15, 2005 (gmt 0)

10+ Year Member



mines the same as yours so i don't think the PATH has anything to do with it.

it might still generate a hash without, just possibly the wrong one, although i'm not certain about that.

hughie

10:09 am on Mar 15, 2005 (gmt 0)

10+ Year Member



i don't think the LibC.. has anything to do with PHP, it's relating to the Hash Generation C file.

Be good if someone with a bit more knowledge of .so files and so forth could help us out here.

cheers
hughie

Weirfire

11:42 am on Apr 18, 2005 (gmt 0)

10+ Year Member



Hi Chemzoo,

Did you manage to get the code 4 error fixed? I'm also having the same problem but I'm using the 2nd MOD for the HSBC/osCommerce to generate the orderhash. I'm not actually using oscommerce however but I'd be interested to know if you got anywhere with the error.