Some of you may have just read about my experiences setting up the HSBC CPI system on Linux in my previous post about this subject well, unfortunately I’ve got bad news for you… after running some upgrades on our production web hosting server, guess what, it broke!
And it didn’t break a little bit, it broke a lot, to the point where we couldn’t get it working again, well, we probably could have, but since that would have meant un-installing the updates we have just installed, and that basically meant making our server less secure than it might have otherwise been, we decided to abandon the C version of the HSBC CPI installation and try something else. Not an easy decision considering how hard this was to set up in the first place, but now it’s working again it was absolutely definitely the right decision.
So, in the spirit of helpfulness, I’m going to tell you how we got this up and running again using a different method.
We (my business partner James and I) are 90% certain that an update to the GCC library on our Linux server was responsible for breaking the LibcCpiTools.so implementation of the HSBC CPI system.
The Java Implementation
After deciding that the GCC update we ran was the most likely candidate for breaking this system, we decided to try using Java.
Thankfully, I have some experience programming Java, and I think if it wasn’t for that I would have completely given up on this whole HSBC integration thing. You’re not going to need to know anything about Java programming in order to get this up and running though so don’t worry.
What you’ll need
You are going to need a few things before you get started:
- Your shared secret (as supplied by the HSBC)
- A unique IP address (so you can use an SSL certificate for your domain)
- An SSL certificate
- A web hosting package with PHP enabled
- The facility to use a Java server on your web hosting package (like Apache Tomcat)
- WinRAR or WinZip (Mac users try Zipeg)
- A .war file of the Java files supplied by the HSBC – this is a package of Java files, stored almost like a .zip file. (Don’t worry too much, I’ve got one I made earlier you can download later)
- The scripts from my previous post regarding the HSBC CPI system.
Setting It Up
Web Hosting
You’ll need a hosting package with PHP enabled, a unique IP address, the facility to install SSL certificates and the facility to use a Java server (like Apache Tomcat).
Apache Tomcat
I can’t really tell you how to install this or get it working, unfortunately I had to rely on my colleague James setting this up for me, however I’m sure you’ll find everything you need on the Apache Tomcat website.
SSL Certificate
You’ll need a unique IP address for your SSL certificate, then ask your web hosting company for an SSL certificate. If they can’t supply you with one, you can get them from businesses like Thawte, Verisign or Globalsign. You’ll need to get it installed on your web server so you can serve pages over a secure socket (https://)
OrderHash.war
Once you’ve got everything else set up, you’ll need to download my OrderHash.war – this is simply the Java files supplied by the HSBC but packaged into a .war file. If you’re on Windows use WinRAR to browse the .war file (Mac users use Zipeg) You’ll be able to browse the folder structure, which should look something like this:
Putting it all together
You need to upload your new .war file into your Java server, the process may differ with different Java Servers, but with Tomcat and the Plesk web hosting control panel, it’s as simple as uploading the OrderHash.war file into Plesk.
Now you’re ready to go!
Try uploading the sample.html file supplied by the HSBC but changing the action of the form to point to the new Java Server Page:
<form name="cpiForm" action="http://www.example.com:9080/OrderHash/OrderHash.jsp" method="POST" onSubmit="singleSubmit(this)">
With luck you’ll be able to generate a valid Order Hash! Now, as before, the actual OrderHash generator creates some pretty ugly HTML, and you wouldn’t want your clients looking at it, but you can use the PHP files I wrote in my previous post on this subject to “wrap” the horrible HSBC pages in your own code.
Enjoy!

2 responses so far ↓
1 Install HSBC CPI credit card processing on Linux // Nov 2, 2008 at 4:46 pm
[...] I have written some more information about setting up the HSBC CPI using the Java method rather than the C method outlined [...]
2 admin // Nov 2, 2008 at 6:13 pm
I’ve also found this, which looks like a very useful PHP script indeed!
http://www.davebarnes.co.uk/2008/10/hsbc-cpi-integration/
Leave a Comment