Thursday 16 August 2012

integrate icici payment gateway php without JavaBridge/JDK



The Installation process for SFAClient.zip

 

1.     Unzip SFAClient.zip. This will create a folder called SFAClient
2.    SFAClient contains the following files and directory.
1.     Sfa – SFA Client library (contains the PHP Sfa library)
2.     Test Pages – Sample pages for transactions and a test page (test.php) for testing php.
3.     sfa.properties

PHP Web Application Directory Structure – Sample Example

·         Create the following  PHP Web application directory structure as given below
o   E.g. the Merchant website directory name is “Merchant_Site_Dir”.
·         Copy all the directory and files from unzipped SFAClient to Merchant_Site_Dir .



§  Place the directory Merchant_Site_Dir in C:/wamp/www/ as shown below.
·         Sfa, Test Pages and sfa.properties



Note:
§  Sfa folder should be copied to the folder where TestPages/Merchant pages are present.
§  The directory names are case sensitive. Create them as mention above.











Changes in Test Pages

  • Open the SFAResponse.php and made some changes

<?php
include("Sfa/EncryptionUtil.php");


                        $strMerchantId="00000001";
                        $astrFileName="c://key//sbi//00000001.key";
                        $astrClearData;
                        $ResponseCode = "";
                        $Message = "";
                        $TxnID = "";
                        $ePGTxnID = "";
                        $AuthIdCode = "";
                        $RRN = "";
                        $CVRespCode = "";
                        $Reserve1 = "";
                        $Reserve2 = "";
                        $Reserve3 = "";
                        $Reserve4 = "";
                        $Reserve5 = "";
                        $Reserve6 = "";
                        $Reserve7 = "";
                        $Reserve8 = "";
                        $Reserve9 = "";
                        $Reserve10 = "";


Note : Mercant ID must be same as the .key file name. e.g. if file is 00000001.key then Merchant ID must be 00000001.

  • According to merchant type i.e. SSL or MOTO change select the file and make the changes
    • e.g. if Merchant is SSL Merchant then change the TestSsl.php
<?php


include("Sfa/BillToAddress.php");
include("Sfa/CardInfo.php");
include("Sfa/Merchant.php");
include("Sfa/MPIData.php");
include("Sfa/ShipToAddress.php");
include("Sfa/PGResponse.php");
include("Sfa/PostLibPHP.php");
include("Sfa/PGReserveData.php");

 $oMPI                        =          new     MPIData();

 $oCI               =          new     CardInfo();

 $oPostLibphp =          new     PostLibPHP();

 $oMerchant    =          new     Merchant();

 $oBTA                       =          new     BillToAddress();

 $oSTA                        =          new     ShipToAddress();

 $oPGResp      =          new     PGResponse();

 $oPGReserveData = new PGReserveData();




 $oMerchant->setMerchantDetails("00000001","00001203","00001203","193.545.34.33",rand()."","Ord123","http://10.10.10.167/SFAResponse.php","POST","INR","INV123","req.Sale","100","","Ext1","true","Ext3","Ext4","Ext5");
?>
Put marchant id.


  • e.g. if Merchant is Moto Merchant then change the TestMoto.php



Set the key directory path


·         'Key.Directory' should contain the name of the folder, which contains the merchant key. A trailing slash has to be included at the end of this value. The name of the file (.key file) need not be set. Save the file after making other relevant changes.
§  Key.Directory=D://WAMP//WWW//key//
Note: Don’t include key in key directory path.
·         Enable the verbose parameter to “true” only when required to generate logs. These logs are to be used for debugging (while integration) and should not be set to “true” in production as it might lead to considerable amount of logs depending on the number of transactions.
·         To verify the success of the above operations open the jar file again and check if the properties file has the values set.

 

 

Enabling Curl extensions

 


The curl extension files are

  • libeay32.dll
  • ssleay32.dll

These files should be present in to C:\WINDOWS\system32 and Php installation directory.

Open the php.ini file from PHP installation directory remove the semicolon of extension=php_curl.dll.

 


Disabling mcrypt extensions (for PHP version <= 4.4.4)

 


  • Open the php.ini file from PHP installation directory add the semicolon on start of line  ;extension=php_mcrypt.dll (if semicolon not present).

 Checklist

 

·           Merchant should have access to ePG over https
·           Check connectivity between php
1.     Restart the IIS Server
2.     Browse the testjava.php page either from browser of from IIS as shown below
                                       i.    Url : http://localhost/Merchant_Site_Name/test.php



Transaction Testing

 

·         Restart the Apache
·         Open the PHP page either from browser or from Apache
·         If Merchant is SSL then open TestSsl.php else if Merchant is Moto then TestMoto.php
1.         From IIS

               2.  From Browser
·         Type the URL : http://localhost/Merchant_Site_name/TestSsl.php


Troubleshooting

 


Problem : In log file if you got SSL certificate problem….



Solution : Add the certificate CSR in \Sfa\cacerts.pem file. (Refer Adding Certificates in  Cacerts section).

37 comments:

  1. Can this be done in linux.

    ReplyDelete
  2. how can i create a webpage in .php to fill all of info
    ie: name, address, amount, etc

    ReplyDelete
    Replies
    1. Just simple regular form you can pass required value i.e. name, address, amount, qty etc. to singleSSL.php page.

      Delete
  3. Just simple regular form you can pass required value i.e. name, address, amount, qty etc. to singleSSL.php page.

    ReplyDelete
  4. phpwebsolution what is your email id?

    ReplyDelete
  5. how can i use it with RSFORM joomla?

    ReplyDelete
    Replies
    1. Just Passed the value like name, address, and final amount...

      Delete
  6. Hi..Can u provide me some instruction to use it with magento ?

    ReplyDelete
  7. Hi,

    Please give us step by step procedure to integrate PG with PHP on Linux machine without Java bridge.

    I am doing it but getting errors like,
    1. Error in the properties file. Value for key Directory is not mentioned or is invalid
    2. fgets() expects parameter 1 to be resource, boolean given in /var/www/pg/testpages/Sfa/PostLibPHP.php on line 71

    thanks
    Ram

    ReplyDelete
    Replies
    1. Hi Ram,
      In sfa.properties file write down key file location path
      as follow
      Key.Directory=home/username/public_html/key/

      thanks

      Delete
    2. Thanks for reply.
      sfa.properies file should be within testpages folder.
      It solved the problem.
      -Ram

      Delete
  8. Hi,

    Have you ever done ICICI PG with Commerce on Drupal 7?
    ICICI PG Module available with Drupal 7 is under development.

    Thanks
    Ram

    ReplyDelete
  9. Is there any need to have additional account on icici for making transactions?

    ReplyDelete
  10. is it possible to integrate icici payment gateway firstly on localhost?

    ReplyDelete
    Replies
    1. Yes Ritesh, You can also integrate on localhost also.

      Delete
  11. if possible, then give me step by step procedure, i want to integrate on wamp server.

    ReplyDelete
  12. I have created the ICICI payment gateway as 50 lines code. Don't user SFA folders code etc.

    ReplyDelete
  13. After doing the above mentioned steps in windows + php, when I try to the test.php file, I am getting the error - Fatal error: Class 'Java' not found in D:\wamp\www\gateway\test_pages\test.php on line 25

    ReplyDelete
  14. After doing the above mentioned steps in windows + php, when I try to the TestSsl.php file, I am getting the following error
    Error Occured.
    Error Code:2
    Error Message: No response From Payment Gateway or URL not Found

    ReplyDelete
  15. HI Dear ,

    we require help for configuring the testmoto.php age for fetching the values from payseal and we dont know how it works as it is the first time we are doing ... Kindly contact on 9990413338 ..
    We need integration ASAP we can pay for it if required many thanks...
    or send me ur details to shubhamtripathi@hotmail.com , i'll call u

    ReplyDelete
  16. Hi how to get merchant id and key for testing purposes from payment gateway

    ReplyDelete
  17. Hi Can you please provide me some instruction to use it with Symfony2 ?

    ReplyDelete
  18. Can you please provide instruction about how to integrate with joomla?

    ReplyDelete
  19. while testing testmoto.php i am getting following message

    PostLibPHP postMoto Entered
    PostLibPHP postData Entered.
    PostLibPHP postData Exiting.
    PostLibPHP postMoto Exiting

    ReplyDelete
  20. After doing the above mentioned steps in windows + php, when I try to the testssl.php file, I am getting the error - Fatal error: Class 'Java' not found.. can u help for xampp server on my local..I dont want to use java

    ReplyDelete
  21. I have successfully integrated the payseal.
    I just want to know how do i send order id with my integrated code and get the code on response page. based on this i want to update the db.

    ReplyDelete
  22. I have successfully integrated the payseal.
    i have sent all the details to gateway like address,name email etc. other detail are showing correctly but in MPI details it showing the same Ip address- 10.95.20.6 whether i sent the clients ip to gateway
    Please help me due to IP address problem my gateway has been blocked one time already'
    Thanks

    ReplyDelete
  23. I have completed test trnx on WAMP server, can you tell how to integrate this on website.

    ReplyDelete
  24. i am using drupal 7 and commerce icici pay seal module.after complete the checkout page and click the order then its going to payment page.the page does not redirect to ICICI payment gateway page and reload on the same page.

    ReplyDelete
  25. Hi,
    Thanks for helping us

    I found this error after uplo.ad my sfa folder in http://anewstepahead.com/van/TestMoto.php and http://anewstepahead.com/van/TestSsl.php
    Warning: require_once(java/Java.php): failed to open stream: No such file or directory in /home/anewstepahead/public_html/van/Sfa/PostLibPHP.php on line 2

    Fatal error: require_once(): Failed opening required 'java/Java.php' (include_path='.:/usr/local/lib/php') in /home/anewstepahead/public_html/van/Sfa/PostLibPHP.php on line 2

    I didn't find any java folder

    ReplyDelete
  26. I want to integrate PG with Yii framework ?
    What are the steps i need to follow..? Please HELP..

    ReplyDelete
  27. We have Merchant_Param in CC Avenue, do we have any parameter which come back in post parameter after payment is done ?

    ReplyDelete
  28. Thanks for sharing the important points of view with us. It is really very nice blog which describes how to icici payment gateway plugin

    ReplyDelete
  29. getting the following error
    Error Occured.
    Error Code:2
    Error Message: No response From Payment Gateway or URL not Found
    Even after giving the correct path to key..

    ReplyDelete
  30. Thanks for sharing the important points of view with us. It is really very nice blog which describes how to ICICI payment gateway plugin

    ReplyDelete

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