After multiple attempts we have finally being successful in integrating the ICICI Bank online payment gateway in our Linux severs with Plesk and cPanel. Below are the steps that may help you in configuring the same on your server.
Configuration for PLesk
1. Download the SFA files from the ICICI merchant area and extract on the webserver under ICICI folder.
Extract the sfa.jar file in “SFA_Dependencies” and edit the sfa.properties file with the following entries:
verbose=true
Key.Directory=/var/www/key
OS.Type=UNIX
traceLog=/var/log/tomcat5/icici.log
2. Copy the ICICI JAR files from “SFA_Dependencies” folder to the following folders
- JAR Files to copy: cryptix32.jar, jcert.jar, jnet.jar, jsse.jar, servlet.jar, sfa.jar
- Copied jar files to /usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/ from /var/www/vhosts/domainname.com/httpdocs/ICICI/SFA_Dependencies [run this stape after installation of JavaBridge]
- Reset permissions to these files to tomcat:tomcat under the lib folder
- Also copy the jar files to /usr/share/tomcat5/common/lib folder
- Change the owned and group of copied files as per the existing folder owner (Optional and ensure having 777 permissions on the above folder).
3. Download JavaBridge from below URL
- # wget http://sourceforge.net/projects/php-java-bridge/files/Binary%20package/php-java-bridge_6.2.1/php-java-bridge_6.2.1_documentation.zip/download
Install JavaBridge with the following steps:
- Unzip the php-java-bridge_6.1.2.1_documentation.zip
- # java -classpath JavaBridge.war TestInstallation
- # cp JavaBridge.war /var/lib/tomcat5/webapps/.
- # service tomcat5 restart
- Test the installation at http://plesk02.diadem-tech.com:8080/JavaBridge
Reference URLs:
- http://php-java-bridge.sourceforge.net/pjb/tomcat6.php
- http://php-java-bridge.sourceforge.net/pjb/installation.php
4. Edit the file /var/lib/tomcat5/webapps/JavaBridge/WEB-INF/cgi/php.ini with below lines.
;; -*- mode: Scheme; tab-width:4 -*-
;; A simple php.ini
;; extension_dir is this “cgi” directory
extension_dir=.
;; include php libraries from these directories
include_path=.:/usr/share/pear
java.classpath = /usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/cryptix32.jar;/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/jcert.jar;/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/jnet.jar;/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/jsse.jar;/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/servlet.jar;/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/sfa.jar;
5. Edit /root/.bash_profile to set CLASSPATH as env variable and add the below lines.
include_path=.:/usr/share/pear
CLASSPATH=$CLASSPATH:/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/cryptix32.jar;
CLASSPATH=$CLASSPATH:/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/jnet.jar;
CLASSPATH=$CLASSPATH:/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/servlet.jar;
CLASSPATH=$CLASSPATH:/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/sfa.jar;
CLASSPATH=$CLASSPATH:/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/jcert.jar;
CLASSPATH=$CLASSPATH:/usr/share/tomcat5/webapps/JavaBridge/WEB-INF/lib/jsse.jar;
export include_path
export CLASSPATH
Run the following commands from shell:
- #. .bash_profile to set the environment variable.
- # env to check the environment variables.
- # service tomcat5 restart – Tomcat restart
6. Configure Tomcat to use SUN Java
- # vim /etc/sysconfig/tomcat5
Comment the existing JAVA_HOME and add the below line
JAVA_HOME=”/usr/java/jdk1.6.0_20/” (The JDK version will change as per the installed version)
Restart Tomcat
- # touch /var/log/tomcat5/icici.log
- # chown tomcat.tomcat /var/log/tomcat5/icici.log
7. Stop Apache and Tomcat and then copy the following key files to the /var/www/key directory:
- 0000XXXX.key
- intermediate.cer
- payseal.icicibank-chain-bundle.cer
The .cer files can be found under the cert_bundle folder provided by ICICI. The key file also needs to be downloaded from the merchant admin site or provided by ICICI.
Run the following keyrestore command from the /var/www/key folder:
# keytool -import -alias pgIntermediateCA -file ./intermediate.cer -keystore /usr/java/jdk1.6.0_12/jre/lib/security/cacerts -storepass changeit
This might give an error like keytool error: gnu.javax.crypto.keyring.MalformedKeyringException: incorrect magic which can be ignored.
8. Update the TestSSL.php page and change the response URL and use the updated file:
$oMerchant->setMerchantDetails(“0000XXXX”,”0000XXXX”,”0000XXXX”,”193.545.34.33″,rand().”",”Ord123″,”http://10.10.10.147:8756/SFAResponse.php”,”POST”,”INR”,”INV123″,”req.Preauthorization”,”100″,”",”Ext1″,”true”,”Ext3″,”Ext4″,”Ext5″);
Also in SFAResponse.php and “./Sfa/PostLibPHP.php” file on line 2 would also change from
‘ require_once(“java/Java.php”);’ to ‘ require_once(“java/Java.inc”);’
Test the TestSSL and Testjava pages
- http://domainname.com/ICICI/SFAClient/TestPages/testjava.php
- http://domainname.com/ICICI/SFAClient/TestPages/TestSsl.php
Hopefully the above links would work and the error output log can be checked at:
- # tail –v –f /var/www/vhosts/pgtest.domainname.com/statistics/logs/error.log
cPanel configuration
For cPanel you need to install Tomcat and FastCGI module in PHP to run ICICI PG, below are the steps.
1. Login WHM with root user
2. In the Main page click on Software and then EasyApache (Apache Update)
3. Go through each step as follows.
a) Click “Start customizing based on profile”
b) Select Apache Version – Click Next to proceed with the current version.
c) Select PHP Major Version – Click Next to proceed with the current version.
d) Select PHP Minor version – Click Next to proceed with the current version.
e) Short option list – Click “Exhaustive Options List” to view full options.
Exhaustive Options List – From here you can select the PHP modules you needed
Select mod_fcgid (FCGI module for Apache), FCGI and Tomcat (you can also select other PHP module for future requirement e.g. GD, SOAP, curl, Zend, Zlib, Zip bizip, MySQLi )
f) Click “Save & Build” to start apache-php compilation.
4. Once the compilation over you can verify the installed PHP modules using the following command.
# php –m
And Tomcat from the URL: http://server ip:8080
5. After the installation of Tomcat defines the following important environment variables in /root/.bash_profile
CATALINA_HOME=/usr/local/jakarta/tomcat
CATALINA_BASE=/usr/local/jakarta/tomcat
JAVA_HOME=/usr/local/jdk/
export CATALINA_HOME CATALINA_BASE JAVA_HOME
Now run “#. .bash_profile” command from shell to set the environment variable.
All done now start the ICICI Payment Gateway Integration same as Plesk steps. Only the tomcat path is different i.e. /usr/local/jakarta/tomcat.