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.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.
| Parameter | Type | Description |
|---|---|---|
cComercio | String | Merchant identifier assigned by the acquiring bank. |
cTerminal | String | Terminal identifier assigned by the acquiring bank. |
cClaveFirma | String | Signature key associated with the merchant and terminal. |
cConfPuerto | String | Optional port configuration. Its usage depends on the integration model. |
cVersion | String | Optional protocol version. Its usage depends on the integration model. |
Parameter Behavior by Integration Model
TPVPC Implantado
cConfPuertois optional and can be used to define the communication port.cVersionis optional and can be used to define the protocol version (for example,5.1,6.1, or8.1).- If
cConfPuertois specified,cVersionmust also be specified. - If
cVersionis specified,cConfPuertomust also be specified.
Slim Pack
cConfPuertoshould not be informed.cVersionshould not be informed.- Both values are recovered from the local TPVPC configuration.
Note: Do not assume the same parameter behavior for both integration models. Review your integration type before deciding whether to passcConfPuertoandcVersion.
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
}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:
On this page
Initialize the Library