SunatRepresentacion
Description
Section titled “Description”Generates the printable representation of an Electronic Payment Receipt (CPE) with its QR code. It can take an already-issued CPE (by tipo, serie and numero) and retrieve its real hash from the database, or receive a CPE in JSON to preview the representation before issuing it. Returns a self-contained HTML, printable to PDF, together with the QR content.
Configuration
Section titled “Configuration”| Field | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | SUNAT credential (to get the issuer’s RUC and data) |
| tipo | text | No | Document type (01 invoice, 03 boleta). Defaults to 01 |
| serie | text | No | Series of the already-issued CPE, to fetch it from the database |
| numero | text | No | Number of the already-issued CPE |
| cpe | json | No | CPE in JSON to preview, if serie and numero are not provided |
Credentials
Section titled “Credentials”This module requires a sunat credential type with the following fields:
- Certificate (.p12): the issuer’s digital certificate
- Certificate password
- Issuer RUC (11 digits)
- SOL user and SOL password: SUNAT Clave SOL credentials
- Mode: direct (to SUNAT) or OSE (Electronic Services Operator)
- OSE URL, if mode is OSE
- Environment: beta (testing) or production
Output
Section titled “Output”{ "tipo": "01", "serie": "F001", "numero": 125, "html": "...", "qrText": "20123456789|01|F001|125|18.00|118.00|2026-08-04|6|20123456789|AbCdEf123...", "qrImage": "data:image/png;base64,...", "hash": "AbCdEf123..."}Usage Example
Section titled “Usage Example”{ "credentials_id": "cred-sunat-prod", "tipo": "01", "serie": "F001", "numero": "125"}The SUNAT QR
Section titled “The SUNAT QR”The QR contains a pipe-delimited string with: issuer RUC, document type, serie, numero, IGV, total, issue date, receiver document type, receiver document number and the document’s hash (the signature’s DigestValue).
- If serie and numero are provided, the node retrieves the already-issued, signed CPE from the database, with its real hash.
- If no document has been issued yet, a cpe JSON can be passed to preview the representation; in that case the node signs the XML only to compute the QR hash, without sending it to SUNAT.
- The HTML is self-contained (styles included) and meant to be printed or exported to PDF directly.
Related Nodes
Section titled “Related Nodes”- SunatEmitirCPE - Issue an invoice or boleta
- SunatEmitirNota - Issue a credit or debit note