0% found this document useful (0 votes)
33 views5 pages

ICICI Bank Java PG Integration Guide

This document provides a comprehensive guide for setting up a Java environment and integrating with ICICI Bank's payment gateway. It includes prerequisites, step-by-step instructions for configuring IDEs like Eclipse and IntelliJ IDEA, secure hash calculation logic, and examples of API requests and responses. Additionally, it offers support contact information for further assistance.

Uploaded by

reddy1997.04
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views5 pages

ICICI Bank Java PG Integration Guide

This document provides a comprehensive guide for setting up a Java environment and integrating with ICICI Bank's payment gateway. It includes prerequisites, step-by-step instructions for configuring IDEs like Eclipse and IntelliJ IDEA, secure hash calculation logic, and examples of API requests and responses. Additionally, it offers support contact information for further assistance.

Uploaded by

reddy1997.04
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ICICI Bank PG Installation for JAVA

Documentation

Introduction:
This guide provides step-by-step instructions for setting up a Java
environment and configuring the required APIs for seamless merchant
integration.
1. Prerequisites
Ensure the following software is installed:
Java Development Kit (JDK)

Download from Oracle or OpenJDK.


Install and set the JAVA_HOME environment variable.
Integrated Development Environment (IDE)
Choose one of the following:

Eclipse: Download Eclipse.


IntelliJ IDEA: Download IntelliJ IDEA.

2. Setting Up Eclipse
Step 1: Install Eclipse
Launch the installer and choose "Eclipse IDE for Java Developers."
Complete the installation process.
Step 2: Create a New Java Project
Open Eclipse and navigate to File > New > Java Project.
Name the project (e.g., MerchantIntegration).
Step 3: Add Required Libraries
Right-click on the project and select Properties > Java Build Path > Libraries.
Add any required JAR files, if applicable.

3. Setting up IntelliJ IDEA


Step 1: Install IntelliJ IDEA
Launch the installer and follow the on-screen instructions.
Open IntelliJ IDEA and create a new "Java" project.
Step 2: Configure JDK
ICICI Bank PG Installation for JAVA
During project setup, specify the JDK path.
Step 3: Add Libraries
Go to File > Project Structure > Libraries and add necessary dependencies.

4. Secure Hash Calculation Logic


To calculate the secureHash for API requests, implement the following logic:
import [Link];
import [Link];

public class SecureHashCalculator {


public static String calculateHash(String hashText, String secretKey) throws
Exception {
String hashInput = hashText + secretKey;
MessageDigest md = [Link]("SHA-256");
byte[] hashBytes = [Link]([Link](StandardCharsets.UTF_8));
StringBuilder hexString = new StringBuilder();
for (byte b : hashBytes) {
String hex = [Link](0xff & b);
if ([Link]() == 1) [Link]('0');
[Link](hex);
}
return [Link]();
}
public static void main(String[] args) throws Exception {
String hashKey =
"Test1Test2300.00356vaibhav.walunj1@phicommerce.com917498791441T_033
4527112024222330[Link]
51620545";
String secretKey = "abc";
[Link]("Secure Hash: " + calculateHash(hashKey, secretKey));
}
}
ICICI Bank PG Installation for JAVA

5. Testing API Integration


Example API Request: Initiate Sale
Endpoint:
[Link]
Sample JSON Request:
{
"merchantId": "T_03345",
"merchantTxnNo": "2711202422233",
"amount": "300.00",
"currencyCode": "356",
"payType": "0",
"customerEmailID": "customer@[Link]",
"transactionType": "SALE",
"txnDate": "202412051620545",
"returnURL": "[Link]
"secureHash":
"197613d5ade172104bfd65e72bc07c80a14c65e64ec7335209768d83371243b4"
,
"customerMobileNo": "917498791441",
"addlParam1": "Test1",
"addlParam2": "Test2"
}
cURL Command:
curl --location '[Link] \
--header 'Content-Type: application/json' \
--data-raw '{
"merchantId": "T_03345",
"merchantTxnNo": "2711202422233",
"amount": "300.00",
"currencyCode": "356",
"payType": "0",
ICICI Bank PG Installation for JAVA
"customerEmailID": "customer@[Link]",
"transactionType": "SALE",
"txnDate": "202412051620545",
"returnURL": "[Link]
"secureHash":
"197613d5ade172104bfd65e72bc07c80a14c65e64ec7335209768d83371243b4"
,
"customerMobileNo": "917498791441",
"addlParam1": "Test1",
"addlParam2": "Test2"
}'

6. Handling API Responses


Initiate Sale Response:
{
"responseCode": "R1000",
"merchantId": "T_03345",
"merchantTxnNo": "2711202422233",
"redirectURI": "[Link]
"tranCtx": "Rf58f59c1-48ba-4951-9584-ff2caee2a56c",
"secureHash":
"9a8dcf4c3865eb068941256ba756bc7df722db456ead76ad8687031302151de0"
}

Redirect the customer using the redirectURI along with


the tranCtx parameter:
[Link]
48ba-4951-9584-ff2caee2a56c

7. Additional API Examples

Status Check API


ICICI Bank PG Installation for JAVA

curl --location '[Link] \


--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'merchantID=T_03345' \
--data-urlencode 'merchantTxnNo=HCI17301905408459' \
--data-urlencode 'transactionType=STATUS' \
--data-urlencode
'secureHash=8be33d9071db5087263140d0675a5b991b8bd890cde18cc6a77466
86d4909923'

Refund API
curl --location '[Link] \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'merchantID=T_03345' \
--data-urlencode 'merchantTxnNo=New12345' \
--data-urlencode 'originalTxnNo=HCI17301905408459' \
--data-urlencode 'transactionType=REFUND' \
--data-urlencode
'secureHash=8be33d9071db5087263140d0675a5b991b8bd890cde18cc6a77466
86d4909923' \
--data-urlencode 'amount=10.00'

8. Customer Support
For further assistance please contact msintegration@[Link] for
Support.
This guide ensures a smooth setup process for Java-based integration with
the payment gateway. Let us know if you have any issues

You might also like