Java SDKs
Java ECR Integration
JNI wrapper for Java SE desktop environments, similar to the Android SDK.
Prerequisites
- JDK 8 or later
- Windows 10 (native library dependency)
- ECR native library (.dll) in java.library.path
Transaction Example
import java.net.Socket;
import java.io.*;
public class EcrClient {
public static native int pack(String reqData, int txnType, String signature, byte[] buffer);
public static native int parse(byte[] response, byte[] fields);
public static void main(String[] args) throws Exception {
Socket socket = new Socket("192.168.0.102", 8888);
byte[] buffer = new byte[4096];
pack(requestData, 17, signature, buffer);
socket.getOutputStream().write(buffer);
byte[] resp = new byte[4096];
socket.getInputStream().read(resp);
byte[] fields = new byte[8192];
parse(resp, fields);
System.out.println("Result: " + new String(fields));
socket.close();
}
}
Transaction Flow
Socket Connect → Register (17) → Start Session (18) → pack() + send() → recv() + parse()
Transaction Type Codes
| Code | Transaction Type |
|---|---|
| 0 | Purchase |
| 1 | Purchase with Naqd/Cashback |
| 2 | Refund |
| 3 | Authorization |
| 4 | Purchase Advice (Full) |
| 5 | Purchase Advice (Partial) |
| 6 | Auth Extension |
| 7 | Auth Void |
| 9 | Cash Advance |
| 10 | Reconciliation |
| 11 | Reversal |
| 15 | Bill Payment |
| 17 | Register |
| 18 | Start Session |
| 19 | End Session |
| 23 | Duplicate / Previous Txn |
| 24 | Check Status |
| 25 | Health Check |
Updated 4 days ago