Refund API Integration

Refund a paid KHQR, Deeplink or Card (MPGS) transaction by calling refundTxn with the paymentTokenId and sessionId from its openSessionV2 response.

To get started, you need to generate a security hash and use it to open a session. Generate the Security Hash

Before calling the API, you must create a hash value using the HMAC-SHA512 algorithm.

Open the Session

Once your hash is ready, you can initiate the session.

Save these values, as they are required for the next steps of your integration.

Java Sample : Generate HMAC SHA512 (HEX or Base64)

          
        

Once the hash is generated, invoke the openSessionV2 API.
A successful response will return a sessionId and a paymentTokenId, which are required for subsequent steps in the integration flow.

https://epaymentuat.acledabank.com.kh:8443/MERCHANTNAME/XPAYConnectorServiceInterfaceImplV2/XPAYConnectorServiceInterfaceImplV2RS/refundTxn

Copy

Request - Sample

Copy
{
    "loginId" : "xxxxxx",
    "password" : "xxxxxx",
    "merchantId" : "xxxxxx",
    "hash" : "xxxxxx",
    "paymentTokenId" : "xxxxxx",
    "sessionId" : "xxxxxx",
    "amount" : "1",
    "currency" : "USD",
    "reason" : "Cancelled order"
}

Respond - Sample

Copy
{
    "result" : {
        "code" : 0,
        "message" : "SUCCESS",
        "status" : 0
    }
}

paymentTokenId / sessionId - From openSessionV2 (paymenttokenid / sessionid).

amount - Partial refunds allowed, up to the remaining refundable amount.

currency - Must match the original transaction.

reason - Short reason for the refund.

Response code - 0 = SUCCESS; 334845 = not refundable (unpaid, already fully refunded, or expired).

Click "Try with Sandbox" to test refundTxn.

Try with Sandbox