Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 05-29-2007 09:19:08

flowimages
Member
Registered: 04-23-2007
Posts: 18

HSBC Integration information.

Can anyone advise on what data and activities are required to integrate CCP6 with an HSBC payment gateway?

I have filled in what I think is the appropriate information in the HSBC page of "Manage Processing Gateways", yet when I attempt to run through checkout with an item and am expecting to be redirected to HSBC, I get a red error message saying unable to accept your transaction, and remain at the checkout page.

On the HSBC form page within the CCP Commerce:Orders and Checkout section, I have entered HSBC supplied data into the Security section (reffering url string - https://www.cpi.hsbc.com/servlet, transaction key - 32 alphanumeric code, gateway user - UK12345678GBP), and set the gateway active status to true.

If anyone can advise on what I'm missing out or doing wrong I'd be grateful.

Thanks,
Ed.

Last edited by flowimages (05-29-2007 09:20:51)

Offline

 

#2 05-29-2007 09:35:04

GreenbarnWeb
Banned
Registered: 09-23-2003
Posts: 2743
Website

Re: HSBC Integration information.

Hi

For HSBC you need to ensure you have a valid SSL and the CCP6 is set-up with this.

Your Gateway User/Store ID* = StoreID
Transaction Key/Password = Order Hash Key (Provided by HSBC by Fax or Letter)
Active Status = True

When you want to change from test to live:
In the form Display Code you need to change this line from:
$tmp[3] = 'T';
$olpform['fields']['HIDDEN'][] = array('name'  => 'Mode',
                                       'value' => $tmp[3]);

To:
$tmp[3] = 'P';
$olpform['fields']['HIDDEN'][] = array('name'  => 'Mode',
                                       'value' => $tmp[3]);

Offline

 

#3 05-29-2007 09:44:14

flowimages
Member
Registered: 04-23-2007
Posts: 18

Re: HSBC Integration information.

Thanks for the quick response Howard.

We added SSL to our hosting and re-ran the CCP install process to take advantage of this. The pages are now showing as https://

Offline

 

#4 07-09-2007 11:19:44

flowimages
Member
Registered: 04-23-2007
Posts: 18

Re: HSBC Integration information.

We are still trying to get this working and are running short of ideas why things are proving so difficult.

We've double checked all the data entered in the CCP HSBC payment gateway page, and spoken to other CCP HSBC users who confirm that you don't need to manually add any additional forms or data to our hosting. Our server has been setup with an SSL.

Has setting up HSBC payment integration been a simple exercise for others who have tried it?

Offline

 

#5 07-10-2007 05:35:14

flowimages
Member
Registered: 04-23-2007
Posts: 18

Re: HSBC Integration information.

Have been talking with HSBC tech support. They say the problem is down to timestamps, and that the order needs a 13-digit timestamp to be successful.

I have configured the CCP and KHXC settings to use seconds since epoch, but currently we only seem to have 10 digits, not 13 (milliseconds not included).

Am I right in thinking that CCP will get its time reference from the host server?

Offline

 

#6 07-10-2007 08:43:37

GreenbarnWeb
Banned
Registered: 09-23-2003
Posts: 2743
Website

Re: HSBC Integration information.

Hi

Check you have the latest HSBC Form Display Code:

Code:

<?php 

// +--
// | This processor integration references an external
// | URL for processing.  All external processing gateways
// | work in the same manner.  An order information array
// | is made available globally under the the global name
// | 'ecom.order_summary'.
// |
// | This must set a global variable named 'ecom.olpform'
// | which contains the form information to be posted to
// | the external gateway URL.
// |
// | Anything printed within this code will be printed
// | above the form instructions on the payment information
// | page.
// +--

// +--
// | The username entered for HSBC should be in the
// | following format:
// |
// | HSBC Store ID
// +--

// +--
// | THERE IS NO NEED TO EDIT THE CODE BELOW THIS POINT TO 
// | ACTIVATE THIS INTEGRATION.  ONLY EDIT THIS CODE TO MODIFY
// | HOW THIS INTEGRATION WORKS.  BE SURE YOU KNOW WHAT YOU'RE 
// | DOING!
// +--

// +--
// | Get a few global variables.
// +--

$app      = $this->globals('khxc.app');
$eol      = $this->globals('khxc.eol');
$order    = $this->globals('ecom.order_summary');
$tmp=array();
$private_path       = $this->globals('khxc.path_private');

if ($this->debug) {$this->debugger("hsbcform: Private Path '{$private_path}'");}
require_once($private_path . '/apps/' . $app . '/GBU_OLP/ext/hsbc_crypto.php');

// +--
// | Printable form instructions.
// +--

$instructions = "After verifying your order information and clicking the 'Continue' button, you will be directed to our online processing partner's secure site to enter your payment information. Once your payment information is entered and verified, you will be directed back to this web site for your order confirmation.";

// +--
// | Create our relay URL.
// +--

$url_relay  = $this->globals('khxc.url_ssl') . '/relay/' . $app . '.php';

// +--
// | Set up the olpform array.
// +--

$olpform = array('url'    => 'https://www.cpi.hsbc.com/servlet',
                 'button' => 'Continue',
                 'fields' => array());



// +--
// | Create the HIDDEN fields for the form.
// +--

$olpform['fields']['HIDDEN'][] = array('name'  => 'StorefrontId',
                                       'value' => $order['gateway']['userid']);
$tmp[0] = $order['gateway']['userid'];

$olpform['fields']['HIDDEN'][] = array('name'  => 'CpiDirectResultUrl',
                                       'value' => $url_relay);
$tmp[1] = $url_relay;

$olpform['fields']['HIDDEN'][] = array('name'  => 'CpiReturnUrl',
                                       'value' => $url_relay);
$tmp[2] = $url_relay;

$tmp[3] = 'T';
$olpform['fields']['HIDDEN'][] = array('name'  => 'Mode',
                                       'value' => $tmp[3]);

$tmp[4] = $order['order']['id'];
$olpform['fields']['HIDDEN'][] = array('name'  => 'OrderId',
                                       'value' => $tmp[4]);

$amount = $order['order']['ordertotal'] * 100;
$tmp[5] = $amount;
$olpform['fields']['HIDDEN'][] = array('name'  => 'PurchaseAmount',
                                       'value' => $amount);

$tmp[6] = 'Capture';
$olpform['fields']['HIDDEN'][] = array('name'  => 'TransactionType',
                                       'value' => $tmp[6]);

$tmp[7] = $order['order']['epochorder'] * 1000;
$olpform['fields']['HIDDEN'][] = array('name'  => 'TimeStamp',
                                       'value' => $tmp[7]);

$tmp[8] = $order['order']['fname'];
$olpform['fields']['HIDDEN'][] = array('name'  => 'BillingFirstName',
                                       'value' => $order['order']['fname'] );

$tmp[9] = $order['order']['lname'];
$olpform['fields']['HIDDEN'][] = array('name'  => 'BillingLastName',
                                       'value' => $order['order']['lname']);

$tmp[10] = $order['order']['addone'];
$olpform['fields']['HIDDEN'][] = array('name'  => 'BillingAddress1',
                                       'value' => $order['order']['addone']);

$tmp[11] = $order['order']['addtwo'];
$olpform['fields']['HIDDEN'][] = array('name'  => 'BillingAddress2',
                                       'value' => $order['order']['addtwo']);

$tmp[12] = $order['order']['city'];
$olpform['fields']['HIDDEN'][] = array('name'  => 'BillingCity',
                                       'value' => $order['order']['city']);

$tmp[13] = $order['order']['stateprov'];
$olpform['fields']['HIDDEN'][] = array('name'  => 'BillingCounty',
                                       'value' => $order['order']['stateprov']);

// +--
// | Load the DB class.
// +--

if (!($this->KHXC_DB)) {

     $this->KHXC_DB =& $this->quick_object('KHXC_DB','khxc','KHXC_DB_1');

     if ($this->IsError($this->KHXC_DB)) {return $this->KHXC_DB;}

} // End of if statement.
// Need to find the HSBC Country code
$table = $app . '_country';

$column_string = $this->KHXC_DB->table_column_string($table);

if ($this->IsError($column_string)) {return $column_string;}

$sql   = "SELECT {$column_string} FROM {$table} WHERE id=";
$sql  .= $this->KHXC_DB->quote($order['order']['country']);

$result = $this->KHXC_DB->sql_do(array('sql'   => $sql,
                                       'table' => $table,
                                       'order' => array('id' => 'ASC')));

if ($this->IsError($result)) {return $result;}


// +--
// | Loop through and see if we get a hit on a response code field.
// +--
foreach ($result as $num => $row) {

     $tmp[14] = $row['hsbccode'];

}
$olpform['fields']['HIDDEN'][] = array('name'  => 'BillingCountry',
                                       'value' => $tmp[14]);

$tmp[15] = $order['order']['postalcode'];
$olpform['fields']['HIDDEN'][] = array('name'  => 'BillingPostal',
                                       'value' => $order['order']['postalcode']);
$tmp[16] = $this->globals('khxc_user.id');
$olpform['fields']['HIDDEN'][] = array('name'  => 'ShopperEmail',
                                       'value' => $this->globals('khxc_user.id'));
$tmp[17] = '826';
$olpform['fields']['HIDDEN'][] = array('name'  => 'PurchaseCurrency',
                                       'value' => $tmp[17]);
$tmp[18] = 'Online Order';
$olpform['fields']['HIDDEN'][] = array('name'  => 'OrderDesc',
                                       'value' => $tmp[18]);

$tmp[19] = $order['order']['addone'];
$olpform['fields']['HIDDEN'][] = array('name'  => 'ShippingAddress1',
                                       'value' => $order['order']['addone']);

$tmp[20] = $order['order']['addtwo'];
$olpform['fields']['HIDDEN'][] = array('name'  => 'ShippingAddress2',
                                       'value' => $order['order']['addtwo']);

$tmp[21] = $order['order']['city'];
$olpform['fields']['HIDDEN'][] = array('name'  => 'ShippingCity',
                                       'value' => $order['order']['city']);
$tmp[22] = '826';
$olpform['fields']['HIDDEN'][] = array('name'  => 'ShippingCountry',
                                       'value' => $tmp[22]);


$tmp[23] = $order['order']['stateprov'];
$olpform['fields']['HIDDEN'][] = array('name'  => 'ShippingCounty',
                                       'value' => $order['order']['stateprov']);
$tmp[24] = $order['order']['fname'];
$olpform['fields']['HIDDEN'][] = array('name'  => 'ShippingFirstName',
                                       'value' => $order['order']['fname'] );

$tmp[25] = $order['order']['lname'];
$olpform['fields']['HIDDEN'][] = array('name'  => 'ShippingLastName',
                                       'value' => $order['order']['lname']);
$tmp[26] = $order['order']['postalcode'];
$olpform['fields']['HIDDEN'][] = array('name'  => 'ShippingPostal',
                                       'value' => $order['order']['postalcode']);
                                                



if ($this->debug) {$this->debugger("HSBC: Order Hash Array: " . print_r($tmp,1));}

$orderhash = generateHash($tmp, $order['gateway']['transkey']);
unset($tmp);
if ($this->debug) {$this->debugger("HSBC: Order Hash: '{$orderhash}'");}

$olpform['fields']['HIDDEN'][] = array('name'  => 'OrderHash',
                                       'value' => $orderhash);

// +--
// | Create the DISPLAY fields for the form.
// +--

$olpform['fields']['DISPLAY'][] = array('type'   => 'PAYFORMCONTINUE',
                                        'params' => array('name'     => 'ecom_continue',
                                                          'required' => 1,
                                                          'display'  => 'Payment Information',
                                                          'desc'     => $instructions,
                                                          'option'   => 'Enter Payment Information'));

// +--
// | Globalize the $olpform array and return.
// +--

$this->globals('ecom.olpform',$olpform);

?>

Offline

 

#7 07-10-2007 09:21:38

flowimages
Member
Registered: 04-23-2007
Posts: 18

Re: HSBC Integration information.

Pretty sure our code is up to date. I tried the above instead and the result is still the same.

Offline

 

#8 07-10-2007 11:21:08

flowimages
Member
Registered: 04-23-2007
Posts: 18

Re: HSBC Integration information.

HSBC tech support gave me an example of the timestamp information they were receiving from the cart -  1.184077089 - ten digits, so still three digits short of what is required, and with a decimal point in it to add to the confusion.

After more head scratching and some Googling, we found someone having a similar problem with HSBC in OScommerce.

They suggested changing the multiply (*1000) into a straight addition (."000").

Original code:

$tmp[7] = $order['order']['epochorder'] * 1000;
$olpform['fields']['HIDDEN'][] = array('name'  => 'TimeStamp',
                                       'value' => $tmp[7]);

Modified code:

$tmp[7] = $order['order']['epochorder']."000" ;
$olpform['fields']['HIDDEN'][] = array('name'  => 'TimeStamp',
                                       'value' => $tmp[7]);

That's meant that it's stopped doing a mathematical equation and is now just adding 3 zeros. Seems to have worked a treat...

Last edited by flowimages (07-10-2007 11:43:20)

Offline

 

#9 08-31-2007 05:03:13

scottc
Member
Registered: 08-06-2007
Posts: 93
Website

Re: HSBC Integration information.

I too had the same problems and HSBC tole me it was the time stamp. I changed the code as per flowimages suggestion and it also worked. However when i changed the code to be live as oppose to in test "T" to a "P" as mentioned above, it does not work and i get the following error message on the site, "Unfortunately, we are unable to accept your transaction. There may be a problem with the payment information you entered, or our online processor may be experiencing technical difficulties at the present time. You can attempt to process your order again, or contact us to discuss other payment options."

Can anyone help?

Regards

Scott

Offline

 

#10 08-31-2007 05:29:32

GreenbarnWeb
Banned
Registered: 09-23-2003
Posts: 2743
Website

Re: HSBC Integration information.

Hi Scot,

Please make sure HSBC as set your account live.

Offline

 

#11 11-05-2008 09:17:49

jomtm
Member
Registered: 04-03-2008
Posts: 29

Re: HSBC Integration information.

I'm having exactly the same problem, with the timestamp change it work in test mode but as soon as I change it to live I get the error message.

Has anyone found a solution to this?

(My HSBC account is definitely live)

Offline

 

#12 11-06-2008 06:52:43

GreenbarnWeb
Banned
Registered: 09-23-2003
Posts: 2743
Website

Re: HSBC Integration information.

Hi

Double check with HSBC that they have set your account live, if it is then get them to tell you want is causing your problem.

Offline

 

#13 03-20-2009 07:15:03

bbac
Member
From: Bristol, UK
Registered: 08-25-2008
Posts: 141

Re: HSBC Integration information.

For some reason, this problem has suddenly hit me too and I've had to alter the "*1000" to ."000" - the POST variables were:

Code:

7     PAYMENT--TimeStamp     TimeStamp     text     1.237501701E+12

in the orgininal code, and

Code:

7     PAYMENT--TimeStamp     TimeStamp     hidden     1237551155000

after the change.

Can I suggest that this change is made in any future releases of the HSBC code?

Last edited by bbac (03-20-2009 07:15:52)

Offline

 

#14 03-29-2010 06:18:00

dansmith490
Member
From: Barrow, Bury St Edmunds
Registered: 11-10-2008
Posts: 154
Website

Re: HSBC Integration information.

i have changed the code to

$tmp[7] = $order['order']['epochorder']."000" ;
$olpform['fields']['HIDDEN'][] = array('name'  => 'TimeStamp',
                                       'value' => $tmp[7]);

but still getting repsonse code 10 error

Offline

 

#15 05-07-2010 07:07:47

karlconnor
Member
Registered: 02-25-2010
Posts: 10

Re: HSBC Integration information.

I am still getting the timestamp error also

Offline

 

Board footer