Initialize the Library

Initialization is a mandatory requirement that must be performed once per application lifecycle when your application starts. This process configures the core middleware components and establishes the communication context required for all subsequent operations.

This initialization flow applies to both TPVPC Implantado and Slim Pack, but some parameters behave differently depending on the integration model.

The fnDllIniTpvpcLatente Function

The entry point for any Get Central session is the fnDllIniTpvpcLatente function. This function initializes the communication layer and must be executed before any payment, pre-authorization, confirmation, or refund operation. If initialization succeeds, the library remains active for the lifetime of the application.
information icon
In the TPVPC Implantado JavaScript integration path, this same initialization is executed through the local service layer.

Initialization Parameters

The initialization call requires a fixed set of parameters. The table below lists the exact parameter names as defined by the library, together with their purpose.

ParameterTypeDescription
cComercioStringMerchant identifier assigned by the acquiring bank.
cTerminalStringTerminal identifier assigned by the acquiring bank.
cClaveFirmaStringSignature key associated with the merchant and terminal.
cConfPuertoStringOptional port configuration. Its usage depends on the integration model.
cVersionStringOptional protocol version. Its usage depends on the integration model.

Parameter Behavior by Integration Model

TPVPC Implantado

  • cConfPuerto is optional and can be used to define the communication port.
  • cVersion is optional and can be used to define the protocol version (for example, 5.1, 6.1, or 8.1).
  • If cConfPuerto is specified, cVersion must also be specified.
  • If cVersion is specified, cConfPuerto must also be specified.

Slim Pack

  • cConfPuerto should not be informed.
  • cVersion should not be informed.
  • Both values are recovered from the local TPVPC configuration.
information icon
Note: Do not assume the same parameter behavior for both integration models. Review your integration type before deciding whether to pass cConfPuerto and cVersion.

Implementation Example

The example below shows a typical C# implementation of the initialization call. The application must verify that the return value is 0 before proceeding with any transaction.
csharp
int result = fnDllIniTpvpcLatente( "99999999", // cComercio "00000001", // cTerminal "CLAVE123456", // cClaveFirma "", // cConfPuerto "" // cVersion ); if (result == 0) { // Library initialized successfully }
For Slim Pack, cConfPuerto and cVersion should be left empty.
For TPVPC Implantado, these parameters may also be left empty, unless a specific port and protocol version must be provided as part of the deployment.

Important Considerations

Initialization must only be performed once per application lifecycle. Repeating the initialization call without properly closing the library may result in communication errors or locked resources.

If the function returns a value other than 0, the library has not been initialized. The application must evaluate the returned error code and must not attempt any financial operation until initialization succeeds.
If the function returns -2, the library could not load the configuration XML. The application should review the local configuration and required components before retrying initialization.

Next Steps

After successful initialization, the application can begin executing financial operations:

  1. Process a Single-Step Payment
  2. Handle Result Codes and Errors