Getnet DocsGetnet Docs

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

ParameterTypeRequiredDescription
cComercioStringYesMerchant identifier assigned by the acquirer.
cTerminalStringYesTerminal identifier associated with the PIN pad.
cClaveFirmaStringYesSignature key for the merchant and terminal.
cConfPuertoStringNoOptional port configuration. Leave empty to use local configuration.
cVersionStringNoOptional 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

ParameterTypeRequiredDescription
cImporteStringYesTransaction amount in format XXXXXXXXX.XX.
cFacturaStringYesMerchant reference for the transaction.
cTipoOperStringYesOperation type: PAGO or PREAUTORIZACION.
iTamMaxRespintYesMaximum 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: