Tuesday 24 July 2012

Integrating ICICI Payment Gateway in Linux with PHP



1.Download the SFA files from the ICICI merchant area and extract on the web server under ICICI folder.
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/ yourdomainname.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
•   http://sourceforge.net/projects/php-java-bridge/files/Binary%20package/php-java-bridge_6.2.1/php-javabridge_6.2.1_documentation.zip/download
Install JavaBridge with the following steps:
• Deploy all file in apache server. Please extract jar file from javabridge.war, after extracting war file search for
Javabridge.jar file which will be there WEBINF/lib.
• Please extract jar file from javabridge.war and run using below command.
• java -jar JavaBridge.jar
• After that one popup window will appear for port detail. Please select port 8080 and click on ok button.
• If you are using CUI (character user interface) interface then need to run mentioned command. Please run
mentioned command and let me know output.
• java -jar /usr/lib/php/modules/JavaBridge.jar HTTP_LOCAL:8080 3 JavaBridge.log
Copy java folder which is there in Java Bridge\META-INF under the TestPages folder on the server.
Kindly make the changes in testjava.php ---------> include_once("java/Java.inc")  
Note: J should be in uppercase in Java.inc
http://yourdomainname.com/ICICI/SFAClient/TestPages/testjava.php --> to check Java Bridge Installation.4. Edit php.ini files with below lines.
[java]
java.hosts = 127.0.0.1:8080
java.servlet = On,Off,User as per the prevelant scenario.
java.log_file="/home/java_bridge.log"
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;
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;
Note: - Latest JavaBridge 5.4.2 does not require you to set the classpath in the php.ini file unlike the  earlier versions.
              Above highlighted path is example path kindly set as per your system path.
  5.  Place below jar files in class path
   a) cryptix32.jar
   b) jcert.jar
   c) jnet.jar
   d) servlet.jar
   e) jsse.jar
   f)  sfa.jar
If you are not very sure of this you could always put the .jar files in $JAVA_HOME$/jre/lib/ext folder, which is class path by
default.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;
• # env to check the environment variables.
• Once above jar file is set Restart Application server.
Note: - Above highlighted path is example path kindly set as per your system path.
6. 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
Stop Apache or  Tomcat and then copy the following key files to the /var/www/key directory:
• 0000XXXX.key
7. Update the TestSSL.php page change Merchant ID & Response URL and use the updated file:
$oMerchant-
>setMerchantDetails(“0000XXXX”,”0000XXXX”,”0000XXXX”,”193.545.34.33,rand().”",”Ord123,”http://10.10.10.147:8756/S
FAResponse.php”,”POST”,”INR”,”INV123,”req.Sale”,”100,”",”Ext1,”true”,”Ext3,”Ext4,”Ext5);
 In SFAResponse.php and “PostLibPHP.php” file on line 2 change
             ‘ require_once(“java/Java.php”);’ to ‘ require_once(“java/Java.inc”);’
Change the key path as per your system path in SFAResponse.php
 $strMerchantId="0000XXXX";
             $astrFileName="var/www/key/0000XXXX.key";
Execute TestSSL
• http://domainname.com/ICICI/SFAClient/TestPages/TestSsl.php ---> will redirect to ICICI Payseal Page

2 comments:

  1. I want to run this on a windows machine , i have a php supported web host . what modification do i need to do.

    ReplyDelete
  2. i am getting this----
    Fatal error: unknown error: please see back end log for details in C:\xampp\htdocs\daily_purchase_new\icici1\SFAClient\TestPages\java\Java.inc on line 869

    local url--http://localhost/daily_purchase_new/icici1/SFAClient/TestPages/TestSsl.php

    ReplyDelete

Note: only a member of this blog may post a comment.