Skip to content

AfipRepresentacion

Generates the printable representation of an AFIP voucher (invoice or note) with the mandatory QR code (RG 4291/2018). It takes the output of the AfipCreateInvoice or AfipCreditNote node (number, CAE, total) and returns a self-contained HTML, printable to PDF. The QR is computed client-side, without calling the SDK.

FieldTypeRequiredDescription
credentials_idcredentialsNoAFIP credential (to take the issuer CUIT)
voucher_typenumberNoVoucher type (1/6/11…)
point_of_salenumberNoPoint of sale
voucher_numbernumberYesIssued voucher number
caetextYesCAE returned by AFIP
cae_fch_vtotextNoCAE due date (YYYYMMDD)
total_amountnumberYesTotal amount
doc_typenumberNoReceiver document type
doc_numbertextNoReceiver document number
issue_datetextNoDate (YYYYMMDD)
currencyselectNoPES=Pesos, DOL=Dollars
{
"html": "<!DOCTYPE html>...",
"qrUrl": "https://www.afip.gob.ar/fe/qr/?p=eyJ2ZXIiOjEs...",
"qrImage": "data:image/png;base64,...",
"qrData": { "ver": 1, "cuit": 30000000007, "codAut": 71234567890123, "...": "..." },
"voucher_number": 42,
"cae": "71234567890123"
}

The QR contains a URL https://www.afip.gob.ar/fe/qr/?p={base64} where the encoded JSON carries: version, date, issuer CUIT, point of sale, voucher type and number, amount, currency, exchange rate, receiver document type and number, and the CAE (tipoCodAut: "E", codAut). Anyone can verify the voucher by scanning it.

  1. AfipCreateInvoice — issues the invoice and returns the CAE
  2. AfipRepresentacion — generates the HTML with the QR (chains the previous step’s data)
  3. Save/send the PDF (by printing the HTML)
  • The QR is mandatory in the printed representation since RG 4291/2018.
  • The issuer CUIT is taken from the credential if the cuit field is not provided.
  • It does not call the SDK: the QR and HTML are generated locally.