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.
Hi, I'm setting up HSBC payment gateway, I've followed the instructions in the Wiki but I'm getting this error message when I click Enter Payment Info -
"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".
I've checked and the merchant account is active.
I've been given a CPI Hash Key by my client (32 characters in length), is this the same as the Order Hash Key? The hash key field within the admin config page doesn't seem to allow me to enter enough characters.
Can anyone help?
Offline
Hi
If you followed the instruction it will work correctly. Make sure on HSBC that the transaction is not declined.
Offline
Hi
I am attempting to get the HSBC CPI to work and am completely stuck.
If you select the payment method, on clicking continue it immediatley sends you to a page of text (sample below).
All other options work fine. wwwprintmyflyer.com
Any advice?? HSBC say its not their fault... they always say that!
a; $ks = 8; $key=substr($abyte1,0,$ks); return des ($key, $abyte0, 1, 1, $iv); } function rot13(&$abyte0) { for($i = 0; $i < strlen($abyte0); $i++) { $c = ord($abyte0[$i]); if($c >= ord('a') && $c <= ord('m') || $c >= ord('A') && $c <= ord('M')) $abyte0[$i] = chr($c + 13); else if($c >= ord('n') && $c <= ord('z') || $c >= ord('N') && $c <= ord('Z')) $abyte0[$i] = chr($c - 13); } } function decrypt($abyte0, $abyte1) { $iv = $this->a; $ks = 8; $key=substr($abyte1,0,$ks); $ret = des ($key, $abyte0, 0, 1, $iv); while($ret[strlen($ret)-1]=="\4" && strlen($ret)>0){ $ret=substr($ret,0,strlen($ret)-1); } return $ret; } function encryptEncode($abyte0, $abyte1) { return $this->encode($this->encrypt($abyte0, $abyte1)); } function decodeDecrypt($s, $abyte0) { return $this->decrypt($this->decode($s),$abyte0); } function initKey($s, $s1, $s2) { $abyte0 =chr(0); $abyte1 = $s1; $abyte2 = $s2; $byte0 = 4; $i = $byte0 + 9; $j = rand(0,30); $j = 0; if($j > $byte0 * $i) $j -= $byte0 * $i; $k = 0; for($l = 0; $l < $byte0 * $i; $l++){ switch(($j + $l) % $i) { case 4: // '\004' case 6: // '\006' case 8: // '\b' case 9: // '\t' default: break; case 7: // '\007' if($k < 2){ $abyte0 = $this->encrypt($abyte1, $abyte2); } break; case 5: // '\005' if($k < 2){ $abyte0 = $this->encrypt($abyte1, $abyte2); } break; case 10: // '\n' if($k < 2){ $abyte0 = $this->encrypt($abyte1, $abyte2); } break; case 3: // '\003' if($k == 3){ $k++; } break; case 0: // '\0' if($k == 2) { $abyte0 = $this->encrypt($abyte1, $abyte2); $k++; } break; case 1: // '\001' if($k == 1) { $abyte2 = $abyte1; $this->rot13($abyte2); $k++; } break; case 2: // '\002' if($k == 0) { $i1 = 48 + (ord($abyte1[0]) + 10) % 10; $abyte1[0] = chr($i1); $k++; } break; } } return $this->decodeDecrypt($s, $abyte0); } function SecCrypto() { $s
Offline
Hi
Send me your FTP info and I will look at that.
Offline
Hi
I have fixed that, the hsbc_crypto.php in the directory apps\gbu0\GBU_OLP\ext did not have the correct format.
Offline
thanks. much appreciated.
For some reason, the process will only let me pass through to the hsbc servlet when i am logged in.
If i use the "guest checkout" i am returned to the checkout page 1of1.
HSBC say its as all the address information is not being passed over.
"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."
Offline
Hi
In the Form Display Code change this from:
$olpform['fields']['HIDDEN'][] = array('name' => 'ShopperEmail', 'value' => $this->globals('khxc_user.id'));
To:
$olpform['fields']['HIDDEN'][] = array('name' => 'ShopperEmail', 'value' => $order['order']['email']);
Offline
Thanks, I have made that change, but unfortunatly it hasnt fixed the problem.
<?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' => $order['order']['email']); $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
Hi
It should have been this from:
$tmp[16] = $this->globals('khxc_user.id'); $olpform['fields']['HIDDEN'][] = array('name' => 'ShopperEmail', 'value' => $this->globals('khxc_user.id'));
To:
$tmp[16] = $order['order']['email']; $olpform['fields']['HIDDEN'][] = array('name' => 'ShopperEmail', 'value' => $order['order']['email']);
Offline
That works great! Thankyou for all your help.
Now i just need people to start buying!
Cheers again.
Offline