TPVPC: Java Integration
Java-based Point-of-Sale applications integrate with Get Central through a native Java wrapper (JAR) that exposes the same core functions as the native library, while abstracting low-level serial communication details. This guide describes the supported Java integration model, required dependencies, and the correct way to initialize and execute payment operations in a JVM environment.
This guide applies to TpvpcImplantado.
Requirements
Before you begin, ensure you have the following components available:
-
TpvpcImplantado.jar (Java wrapper provided with Get Central)
-
A supported serial communication library, depending on your environment:
- jSSC (recommended for modern Java environments)
- RXTX (legacy option, requires native binaries)
-
Native libraries available in the JVM library path
-
A supported operating system with access to the PIN pad device
On Unix-based systems, the user running the JVM must have permission to access the serial port device.
Java Integration Process
The Java integration mirrors the native TpvpcImplantado API. Requests are executed through strongly typed method calls, and XML is returned only as a response, never sent as a request.
Step 1: Initialize the Communication
Before executing any transaction, the communication channel must be initialized exactly once during the application lifecycle.
Initialization Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
cComercio | String | Yes | Merchant identifier assigned by the acquirer. |
cTerminal | String | Yes | Terminal identifier associated with the PIN pad. |
cClaveFirma | String | Yes | Signature key for the merchant and terminal. |
cConfPuerto | String | No | Optional port configuration. Leave empty to use local configuration. |
cVersion | String | No | Optional protocol version. Leave empty to use the default. |
import es.sermepa.TpvpcImplantado;
public class PaymentService {
private TpvpcImplantado tpv;
public void initialize() {
tpv = new TpvpcImplantado();
int result = tpv.fnDllIniTpvpcLatente(
"99999999",
"00000001",
"CLAVE123456",
"",
""
);
if (result != 0) {
throw new IllegalStateException("Initialization failed: " + result);
}
}
}A return value of 0 indicates that the communication channel has been successfully initialized.
Step 2: Execute a Payment Operation
Once initialized, a standard card-present payment or pre-authorization can be executed using the PIN pad.
Payment Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
cImporte | String | Yes | Transaction amount in format XXXXXXXXX.XX. |
cFactura | String | Yes | Merchant reference for the transaction. |
cTipoOper | String | Yes | Operation type: PAGO or PREAUTORIZACION. |
iTamMaxResp | int | Yes | Maximum size of the response buffer (minimum 8192). |
public String executePayment() {
int bufferSize = 8192;
String xmlResponse = tpv.fnDllOperPinPad(
"1.00",
"TEST0001",
"PAGO",
bufferSize
);
return xmlResponse;
}The method returns an XML string containing the transaction result.
Step 3: Validate the Transaction Result
The integer return code indicates only whether the operation executed correctly at a technical level. The financial outcome must be determined by parsing the XML response.
A transaction is considered authorized only if the response contains:
<estado>F</estado>
<resultado>Autorizada</resultado>Any other result must be treated as a denied transaction.
Step 4: Finalize the Communication
When the application no longer needs to perform payment operations, the communication channel should be closed to release system resources.
public void shutdown() {
tpv.fnDllParaTpvpcLatente();
}Next Steps
After completing the Java integration, you can proceed with further implementation:
- To implement refunds, completions, and pre-authorizations, see the Process a Single-Step Payment guide.
- For details on generating and printing compliant receipts from your Java application, refer to the Generate and Print Receipts documentation.
- To manage card tokens and subscription models, consult the Handle Recurring Payments guide.
- For a comprehensive catalog of security error codes and diagnostic logs, see the Result Codes and Errors and Logs and Troubleshooting reference.