News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

HSBC CPI Integration

Started by jon.hathaway, July 22, 2005, 19:28:56 PM

Previous topic - Next topic

chikkensoop

Any more movement on this? I have a friend desperate to get himself setup with a shop but needs to use HSBC CPI. Also if theres anything I can do to help please dont hesitate to ask... :)

stovesy

If anyone can now loan me the use of an HSBC CPI account for testing, this would be usefull.
Don't post the keys etc. here. PM or email.
Cheers.

chikkensoop

Getting my bod to contact HSBC and get his account put into test mode... will get back to you when I have more info

chikkensoop

Just a quick update, apparently HSBC are dragging their heels and the account wont be set up until near the end of september :(

Anyone else got an active account they can get put in test mode?

stovesy

Think we've got one sorted.  I'll let you know.

At present, CPi is responding back with result code 10. The transaction failed because of invalid input data. I'll have a look tomorrow at this, and then post the code I have so far.

stovesy

Here's what I've got so far.

From the archive, copy the files ps_hsbc.* into your mambo root/administrator/components/com_phpshop/classes/payment
and the file payment.hsbc_return.html into  mambo root/administrator/components/com_phpshop/html

Then, into phpshop admin, choose Add Payment Method.
Payment Method Name: HSBC
Code: HSBC
Payment class name: ps_hsbc
Turn on Use Payment Processor
Make sure that Active ? is checked
Save those changes. You should see it added to the Payment Method List
Go in again and edit the HSBC. Go into the Configuration tab.
Fill in your storefront ID and hash keys.
and alter the Result URL to point to your server.

Now the bad news.
All I'm getting back from the cPi is result code 10 - The transaction failed because of invalid input data
I've been over the data being sent to HSBC (view source on the ThankYou page) and it all looks OK. Maybe another fews sets of eyes will help. OR, it could be something to do with the account I'm testing on. Thanks to husayt for supplying an acocunt.

Anyway. Onwards.

[attachment cleanup by admin]

stovesy

Ground to a halt.

I'm still gettting nothing back from the CPI other than result code 10.
The fields being sent to the CPI look good to me.

Looking on other forums - it seems that HSBC sometimes send out duuf hash keys ???
I'm not sure if this is the case with the account husayt has provided as the hash I'm generating in the return phase, matches the hash sent back by the CPI ?

I'm running out of ideas on this ?
Anyone in a position to help ??
Come on everyone, we are getting close.

devkungfoo

Hi,

I should have been paying more attention to this forum  ;)

I've come to almost the same point as you have here.
I've spent some time on the phone with hsbc and learnt a few things:

when you speak to the support at hsbc, if you don't ask they
will only give you the first error they see in their console.
So ask them to give you a rundown of all errors they see.
This will save you countless callbacks  ::) and will usually
allow you to first sort out any errors that may have crept in
to your fields.


I also used the secCrypto class supplied with the oscommerce hsbc module
and I'm not 100% certain yet but i think that the hash generated by this class
isn't the same as the hash generated by the hsbc supplied testhash.exe
(I'm currently testing this a bit further)

It's a bit vague regarding when to use " (quotes) around fields and this may
also be whats throwing us off??

I will be calling hsbc back tomorrow (as I'm off sick today  :'(  )
I'm looking forward to this call because it should clear things up completely!!

I'll pass on any info when I get some,

stovesy

Can you post what you've got so far so that we may compare code ??
I too am using the has functions from osCommerce and as I've said before I'm getting a matching hash on the data presented in the Return phase, so this is encouraging.

Thanks for you input.

stovesy

Here's another point I thought of.

Is there anything that can be configured from the Admin side of the CPI.
I've been reading through (countless) posts on the whole subject and get the impression that there may be some configuration items which can be switched on or off (Collecting shipping and billing addresses).
I haven't seen the administrator front end so I'm guessing.
If we are providing data which the CPi is not expecting, this may cause errors ???

devkungfoo

#25
OK, Since I couldn't get my code to generate a decent hash, I dumped it in place of the code provided here
and so far so good.

1. The field names are case sensitive, so replace:
         'UserID' => substr($dbbt->f("name"), 0, 32),
with
         'UserId' => substr($dbbt->f("name"), 0, 32),

i.e. UserId not UserID

2. if I block the billing details - everything is fine, it goes to hsbc and prompts
the user for his credit card details. As soon as I add the billing details back it
returns code 10.

I've checked the billing details and I'm 100% certain that all is good.
So that leaves the following possibilities:

1. Quotes around fields that contain spaces
2. Empty fields (in my case BillingCounty) - if empty should it be left out ??
3. I'm delusional and 100% certainty isn't good enough!!

the hsbc documentation is horribly lacking and it's a shame because decent integration
procedures would probably save them a truckload of cash in call centre costs  >:(

I'm gonna be on the phone with hsbc tomorrow, so I'm sure I'll sort out the billing detail problems.
And I'll let you guys know.

Some News
If the billing address details are sent in your post to hsbc then the shipping details
are required too!

And boom! once you provide both the billing and shipping its all fine and dandy.

I suggest that conditional you have on whether on not to provide shipping details should include the billing details
as well, so either just the bare minumum or all details.


stovesy

!!! FINALLY !!!

It's working.
I've just managed to process my first transaction.
It needs polishing now.

I'll post the code later on today.

stovesy

#27
Give this a try then guys, and let me know how things go on.

Make sure that the 'Payment Method type' is 'bank debit'.

[attachment cleanup by admin]

gwen

please could you participate to

http://mambo-phpshop.net/index.php?option=com_smf&Itemid=71&topic=12015.0

you seem to have a big experience on this matter now  :)
Gwen ex-dev team member. I used virtuemart to build www.doudouplanet.com a very good experience for me !

chikkensoop

Just a note to stovesy to see if he's still around... I've not managed to get this working, once it gets to the confirm order stage where it should launch the user off to the CPI pages it just dumps me back to index.php... any ideas?