Sunteți pe pagina 1din 5

eZ Cash IPG Integration User Guide v1.1.

3
Purpose:
Third party merchant can integrate their e-commerce site with the eZ Cash platform and eZ
Cash can be used as a payment mode.
This document describes integration process and the software requirements.

Client Version:
EWalletWebClient-1.1.0.jar

Providing Key:
pubkey.key to encrypt requesting message

Generating Keys:
Generate the key pair using the executable jar.
1. Save the dialogKeyGen.jar
2. Open a command prompt and set the path into the jar location
3. Execute the command: java -jar dialogKeyGen.jar
mypublic.key - to encrypt response message (Need to provide it to Dialog)
myprivkey.key to decrypt response message

Transaction Request:
Parameter
transaction*1
merchantCode*
transactionAmount*
returnUrl*

Description
Unique reference for the transaction
This is a unique value which is given from the eZ Cash system for
each integrated application
Rupee value of the transaction
Format:XXXXXXXXXX.XX
Returning url, which the particular response need to send

Encryption Process Using Query String


Create the query string as mentioned in below

Sysntax:
merchantCode<|> transactionId<|> transactionAmount<|> returnUrl
e.g.
TESTMERCHANT|TX_121212|1000.00| http://dsdadad/jsp
Encrypt the above created query string using the public key which has been given at the
registration.

Encryption Process Reference


For Java/JSP clients ANNEXURE -1
For PHP clients - ANNEXURE -2

Mandatory parameter

For this, encrypted invoice should be included as a hidden parameter in the HTML page with
name merchantInvoice.

e.g.
<input type="hidden" value="<%=Invoice%>" name="merchantInvoice">
When the customer press the Pay via eMoney (or similar) button in this page a POST request
goes to the eZ Cash server with this encrypted invoice. Request should go to the following URL.

e.g.
https://ipg.dialog.lk/ezCashIPGExtranet/servlet_sentinal

Transaction Response:
Parameter
statusCode2*
statusDescription*
transactionId*
merchantCode*
transactionAmount*
walletReferenceId

Description
Status of the requested transaction
Status description
Unique reference for the transaction
This is a unique value which is given from the eZ Cash system for
each integrated application
Rupee value of the transaction
Unique reference number which is given from the eZ Cash system
to the particular transaction

Sysntax:
Once the processing is completed eZ Cash server will direct the customer to the client web
application. This will also send the Encrypted-Receipt as a POST request with name
merchantReciept.

Decryption Process Reference


For Java/JSP clients ANNEXURE -1
For PHP clients - ANNEXURE -2

Receipt Format
Sysntax:
<transactionId>|<statusCode>|<statusDescription>|<transactionAmount>|<merchantCode>|
<walletReferenceId>
e.g
10067|2|Transaction is completed|15|TESTMERCHANT|20120724010224

Mandatory Parameter

Status Codes:
Status Code
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

Description
Completed
Failed
System error
Invalid Customer
Invalid customer status
Customer account lock
Invalid Transaction type
Unauthorized transaction type
Invalid agent
Invalid agent status
Entered amount is not in between max or min limits
eMoney calculation failure
Transaction committing failure
Customer account blocked due to invalid pin retries
Active session expired

ANNEXURE 1

Java Encryption:
You can initiate EMoneyClientRequest to secure request message.

e.g.
EMoneyClientRequest client = new EMoneyClientRequest("public_key_file");

//set above mentioned parameters


String
String
String
String

sMerchantId
sTransactionID
sTranAmount
sReturnURL

=
=
=
=

"TESTMERCHANT";
"TEST" + 123;
"10";
response url;

client.setMerchantCode(sMerchantId);
client.setTransactionAmount(sTranAmount);
client.setTransactionId(sTransactionID);
client.setReturnUrl(sReturnURL);
String invoice = client.getInvoice();

Java Decryption:
To decrypt the message you can use the private key which you have generated
Following process describes the decryption process with using the java wrapper.
You can initiate EMoneyClientResponse to decrypt the response message.

e.g.
String sMerchantReceipt = request.getParameter("merchantReciept");
EMoneyClientReponse clientRes = new EMoneyClientReponse("private key
file");

//set received encrypted message


clientRes. setReciept(sMerchantReceipt);
//Get Status
int status = res.getStatusCode();
//Get Status Description
String statusDesc = res.getStatusDescription();
//Get eZ Cash Reference Id
String refId = res.getWalletReferenceId();

ANNEXURE 2

PHP Encryption:
<?php
$mcode = $_POST['merchantCode']; //merchant code
$tid = $_POST['transactionId']; // transaction id
$tamount = $_POST['transactionAmount']; //transaction amount
$rurl =$_POST['returnUrl'];
$sensitiveData = $mcode.'|'.$tid.'|'.$tamount.'|'.$rurl; // query string
$publicKey = <<<EOD
-----BEGIN PUBLIC KEY----MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCW8KV72IMdhEuuEks4FXTiLU2o
bIpTNIpqhjgiUhtjW4Si8cKLoT7RThyOvUadsgYWejLg2i0BVz+QC6F7pilEfaVS
L/UgGNeNd/m5o/VoX9+caAIyu/n8gBL5JX6asxhjH3FtvCRkT+AgtTY1Kpjb1Btp
1m3mtqHh6+fsIlpH/wIDAQAB
-----END PUBLIC KEY----EOD;
$encrypted = '';
if (!openssl_public_encrypt($sensitiveData, $encrypted, $publicKey))
die('Failed to encrypt data');
$invoice = base64_encode($encrypted); // encoded encrypted query string
?>

PHP Decryption:
<?php
$decrypted = '';
$encrypted = $_POST['merchantReciept'];
$privateKey = <<<EOD
-----BEGIN PRIVATE KEY----Please append your private key content
-----END PRIVATE KEY----EOD;
$encrypted = base64_decode($encrypted); // decode the encrypted query
string
if (!openssl_private_decrypt($encrypted, $decrypted, $privateKey))
die('Failed to decrypt data');
echo "Decrypted value: ". $decrypted;
?>

S-ar putea să vă placă și