Generate and Print Receipts
Every financial operation processed by Get Central may result in the generation of one or more receipts (boletas), depending on the operation type, terminal configuration, and certification rules. Receipt handling is largely managed by the TPVPC itself and is subject to strict technical and regulatory constraints.
This guide applies to TpvpcImplantado.
Get Central supports two receipt-handling models:
- Automatic receipt generation and printing, fully managed by the TPVPC
- Manual receipt handling, by reading receipt-related fields from the XML response
Requirements
Before working with receipts, ensure that:
- A transaction has completed and returned a final XML response
- The host machine has a default printer correctly configured
- The printer type (ticket printer or A4) matches the terminal certification
Receipt layout, content, and printing behavior are controlled by the TPVPC. The client application cannot alter certified receipt formats.
Receipt Generation Process
Receipt handling depends on the operating mode and terminal configuration.
Step 1: Automatic Receipt Generation (TPVPC-Controlled)
When the terminal is configured for it, the TPVPC generates and prints receipts automatically after a successful operation (PAGO, DEVOLUCION, CONFIRMACION, and so on).
Key characteristics:
- The application does not call a receipt-generation function
- Receipt content is derived from the transaction result
- Printing is sent to the system default printer
- The application cannot suppress, customize, or reformat the receipt
Depending on the operation and configuration, the TPVPC may print:
- Customer receipt
- Merchant receipt
- Both receipts
Step 2: Receipt Data in the XML Response
Even when printing is automatic, the XML response returned by Get Central may include receipt-related elements that can be used for:
- On-screen display
- Storage for audit purposes
- Reprinting logic (if supported by the environment)
Common receipt-related elements include:
| Data Element | XML Tag | Description |
|---|---|---|
| Receipt lines | <linea> | Individual formatted receipt lines |
| Customer-only receipt | <ReciboSoloCliente> | Indicates customer-only receipt flow |
| Masked card number | <tarjetaClienteRecibo> | Masked PAN suitable for printing |
| Terminal identifier | <terminal> | Terminal that processed the operation |
| Date and time | <fechaOperacion> | Operation timestamp |
The presence of receipt-related tags depends on the operation type and terminal behavior.
Step 3: Build the Receipt with fnDllGenerateReceipt
TPVPC Implantado generates merchant and cardholder receipts from the library itself. The function returns an integer result code; on success, base64Receipt holds the PDF encoded in base64, which you decode into a properly formatted PDF file to print or show.
Function signature:
int fnDllGenerateReceipt(LPCTSTR cXMLResp, LPTSTR base64Receipt, int iTamMaxbase64Receipt, LPCTSTR nombreComercio, bool bIsClient);
| Parameter | Type | Description |
|---|---|---|
cXMLResp | String | XML holding the data needed to build the receipt. It must be an XML returned by one of the operation functions. |
base64Receipt | Buffer | After the call, holds the receipt as a base64 PDF. |
iTamMaxbase64Receipt | Integer | Size of the base64Receipt parameter. |
nombreComercio | String | Merchant name printed on the receipt. |
bIsClient | Boolean | true for the cardholder copy, false for the merchant copy. |
Return values:
| Code | Meaning |
|---|---|
0 | Receipt generated. base64Receipt holds the base64 PDF. |
-1 | Input XML invalid, or base64Receipt size invalid. |
-2 | XML parse failure, or an error building the receipt. |
StringBuilder receipt = new StringBuilder(65536);
int result = fnDllGenerateReceipt(
xmlResponse.ToString(), // cXMLResp — returned by the operation
receipt, // base64Receipt
receipt.Capacity, // iTamMaxbase64Receipt
"MY STORE", // nombreComercio
true // bIsClient — cardholder copy
);
if (result == 0)
{
byte[] pdf = Convert.FromBase64String(receipt.ToString());
}Call it twice to get both copies — once with bIsClient set to true, once with false.
Security rule: Full PAN, CVV, PIN, or cryptographic data must never be printed or stored. Only masked values returned by the TPVPC may be used.
Step 4: Compliance and Retention
Regardless of the receipt strategy:
- Receipts must only be issued after a transaction is AUTHORIZED
- Stored receipts must match the final transaction result
- Retention policies must follow local fiscal and accounting regulations