Introduction

Unlike other payment processors, CyberSource uses it's own protocol to send order request and receive confirmation. This protocol uses private/public keys. Because of this the payment module is not a plug-n-play one. Before installing this module you should register an account at CyberSource and generate a certificate for your merchant ID. This is done using an external ecert application that comes with CyberSource SDK. Download the correct SDK for your system and generate your keys. This is usually done during installation (if you have a public IP address) or you can do it later. Let's assume that your merchant ID is test_shop. You should get 3 files: test_shop.crt, test_shop.pvt, test_shop.pwd.

Because there are no PHP client libraries for CyberSource protocol, this module uses an external C application as an interface between CyberSource and PHP payment module. This application is written in C and should compile on most popular UNIX systems. This package contains a version compiled on Mandrake 9.1 using 3.2.2 and a source code. To compile the source code (if the included version doesn't work) you should have SSH access to your server, install the CyberSource C SDK, copy the icscard.c file to /opt/CyberSource/SDK/sample and then run:
(statically linked):

gcc -o icscard icscard.c ../../lib/libics2.a -ldl -I../../include/ -lnsl -lresolv -lpthread
(dynamically linked):
gcc -o icscard icscard.c -lics2 -L../../lib -ldl -I../../include/ -lnsl -lresolv -lpthread
Now test the application:
cat /dev/null | ./icscard
You should see the following:
ics_rcode=-1
ics_rflag=ESYSTEM
ics_rmsg=required field is missing (merchant_id)
It's ok, we were trying to use an empty request.

Installation

To proceed with the installation we need the following files:

Let's start by copying includes/languages/english/modules/payment/cybersource.php and includes/modules/payment/cybersource.php to appropriate directories on the server. Next we need to put somewhere our key files. They should be located OUTSIDE the directory which contains HTML pages (usually public_html or www). Assuming that user's home directory on the server is /home/test_shop, we can create a keys subdirectory and copy all test_shop.* files to /home/test_shop/keys. Because the web server usually runs under different credentials than your user name, those files should be readable by everyone. (not secure, I will try to think of something better later)

Next we need to copy the icscard application somewhere. I use /home/test_shop/cgi-bin/icscard. Because the web server usually runs under different credentials than your user name, this file should be readable by everyone.

Now let's go to osCommerce admin, choose Modules->Payment->CyberSource, click Install and then Edit. You need to edit the following fields:

CyberSource Merchant ID
The merchant ID of your shop, in this case it's test_shop
Merchant Keys Path (ICSPATH)
Where the key files are located. In our case it's /home/test_shop/keys
ICS Client Application Path
Path to the icscard application. In our case it's /home/test_shop/cgi-bin/icscard
That should be it. Now start testing the everything extensively, using CyberSource support screen and test card numbers. If you're pretty sure that you can go live, contact CyberSource (you should ask for production server's hostname and port). Go to osCommerce admin and choose Modules->Payment->CyberSource. Click Edit. Put the correct hostname and port into ICS Server and ICS Port fields.

Bugs

I tested this module on two systems and it appears to work. Most problems are caused by problems with accessing the keys or the client application. If can't make it work and you don't have SSH access, try downloading PHPShell, install it on your server and buil/test the client application.

cat /dev/null | /home/test_shop/cgi-bin/icscard
Double-check every configuration value.

If you experience problems with this module, contact me and I will try to solve it.
Piotr Kamiński
webmaster@piotrkaminski.com
AIM: piotrekkaminski
I can answer only questions related to this module, not general CyberSource questions. If you have problems with CyberSource, contact CyberSource support.