Tokenize Integration

Diagram Input Card or Account

Diagram Scan QR

Step 1: Call openSessionV2()

https://epaymentuat.acledabank.com.kh/MERCHANTNAME/XPAYConnectorServiceInterfaceImplV2/XPAYConnectorServiceInterfaceImplV2RS/openSessionV2

Copy

To begin the integration process, start by invoking the openSessionV2 API.
This will generate a sessionId and paymentTokenId, which are essential for further integration steps

Request - Sample

Copy
{
    "loginId" : "xxxxxx",
    "password" : "xxxxxx",
    "merchantID" : "xxxxxxxxxxxxxxxx",
    "signature" : "xxxxxx",
    "xpayTransaction" : {
        "operationType" : 2,
    }
}

Respond - Sample

Copy
"result" : {
    "code" : 0,
    "errorDetails" : "SUCCESS",
    "sessionid" : "8pppwMMSH523EQUTFKCvo/bwMgM=",
    "xTran" : {
        "purchaseAmount" : 0.0,
        "purchaseDate" : 0,
        "quantity" : 0,
        "paymentTokenid" : "FF7sPWUo63BeBDLXDYwpFzT7P3w=",
        "expiryTime" : 0,
        "confirmDate" : 0,
        "purchaseType" : 0,
        "feeAmount" : 0.0
        "chargeDetailsComissionfor" : 0,
        "operationType" : 2
    },
}

Once you have successfully invoked the openSessionV2 API, you can expect to receive a response containing the sessionId and paymentTokenId data. These values will be essential for proceeding with the integration.

Step 2: Redirect to Token Registration Page

Mobile/PC web browsers platform

https://epaymentuat.acledabank.com.kh/MERCHANTNAME/saveCard.jsp

Copy

Sample Post Form

Copy
<form id="_xpayTestForm" name="_xpayTestForm" action="https://epaymentuat.acledabank.com.kh/MERCHANTNAME/paymentPage.jsp" method="post">
     <input type="hidden" id="merchantID" name="merchantID" value="elMED7CT4FKpvMuoWTuneRg1xYI=">
     <input type="hidden" id="sessionid" name="sessionid" value="xxxxxxxxxxxxxxxxxxxx">
     <input type="hidden" id="paymenttokenid" name="paymenttokenid" value="xxxxxxxxxxxxxxxxxxxx">
     <input type="hidden" id="operationType" name="operationType" value="2">
     <input type="hidden" id="successUrlToReturn" name="successUrlToReturn" value="https://www.yourwebsite.com/success">
     <input type="hidden" id="errorUrl" name="errorUrl" value="https://www.yourwebsite.com/failed">
     <input type="submit" value="submit">
    <script>
        $(document).ready(function() {
            function disableBack() { window.history.forward() }
            window.onload = disableBack();
            window.onpageshow = function(evt) { if (evt.persisted) disableBack() }
        });
    </script>
</form>

After obtaining the sessionId and paymentTokenId, you can redirect users to the ACLEDA payment page on both mobile and PC web browsers. To do this, construct an xpayTransaction object that includes the sessionId, paymentTokenId, and other required parameters. This object will facilitate the payment process.

merchantID - Merchant identify code.

sessionid - Retrieve from OpenSessionV2.

paymenttokenid - Payment token identifier generated upon successful OpenSessionV2 authentication.

successUrlToReturn - Post-transaction redirection URL for data transmission.

errorUrl - URL on which we redirect the data generated after error come into transaction.

Remark

Note that the Success URL and Error URL are dynamic values that are obtained from the merchant's posting data. Once the customer completes the transaction on the payment page, we will redirect them to either the Success URL or Error URL, depending on the outcome of the transaction. It is essential to ensure that these URLs are publicly accessible.

Click on the "Try with Sandbox" button to see how it works.

Try with Sandbox

Step 3: Callback URL of Merchant (optional)

In order to integrate with bank tokenize function, first customer need to check on box "Save for next payment?" then merchant need to provide call back url for bank to push notification from bank server to merchant server when transaction post to core banking successful.
To use this function merchant side need to provide link for push notification

Example -

https://www.yourwebsite.com/SuccessURL.jsp?

"_amount": 5,

"_transactionid": "ADC-0064-0054",

"_paymentresult": "SUCCESS",

"_paymenttokenid": "oP1mVvRcgt8Cn9fj5vJA+5LExuw=",

"_resultCode": "0",

"saveToken": 1,

"tokenization": "1122334455",

"userId": "0001******1111",

Step 4: Call payTokenize()

https://epaymentuat.acledabank.com.kh/MERCHANTNAME/XPAYConnectorServiceInterfaceImplV2/XPAYConnectorServiceInterfaceImplV2RS/payTokenize()

Copy

After posting form succeed, you will see this screen for input OTP and the tokenization process will be done.

Request - Sample

Copy
{
    "merchantId" : "elMED7CT4FKpvMuoWTuneRg1xYI=",
    "loginId" : "xxxxxx",
    "password" : "xxxxxx",
    "secretCode" : "xxxxxx",
    "tokenId" : "9941355583007647",
    "transactionId" : "12123545454",
    "invoiceId" : "12123545454",
    "amount" : "5",
    "currency" : "USD",
    "description" : "ABC",
}

Respond - Sample

Copy
"result" : {
    "payReference" : "FT2315104GRRBRZR",
    "paymentTokenId" : "75T/189YBpcAmYJdf/HOm2Bzym4=",
    "result" : {
        "code" : 0,
        "message" : "SUCCESS",
        "status" : 0,
    },
    "sessionId" : "TI9H0Zqc0w2twcuNBSROTB83eV4=",
    "transactionId" : "12123545454",
}
                

Step 5: Call deleteTokenization()

This api is used to delete token id from bank server

https://epaymentuat.acledabank.com.kh/MERCHANTNAME/XPAYConnectorServiceInterfaceImplV2/XPAYConnectorServiceInterfaceImplV2RS/deleteTokenization

Copy

Request - Sample

Copy
{
    "sessionId" : "IWs4YPqBKrIcJRV0Yi3VkVWuQ50=",
    "loginId" : "xxxxxx",
    "password" : "xxxxxx",
    "merchantID" : "xxxxxx",
    "signature" : "xxxxxx",
    "token" : "9416101931001148",
    "paymentTokenId" : "w8Ep1I0EX9zXJUwyn2qUFLk2fwo=",
}

Respond - Sample

Copy
"result" : {
    "code" : 0,
    "errorDetails" : "SUCCESS",
    "TxDirection" : 0,
    "tokenStatus" : 0
}
                

Note

sessionId & paymentTokenId value must get from openSessionV2() api with parameter paymentCard = 1