factus-js iconfactus-js
Facturas

Descargar AttachedDocument XML

Descargar el AttachedDocument XML de una factura electrónica.

Firma del método

downloadAttachedDocumentXml(
  number: string,
  options?: RequestOptions,
): Promise<DownloadBillAttachedDocumentXmlResponse>

Endpoint Factus

GET /v2/bills/{number}/download-attached-document-xml

Fuente oficial: Descargar XML AttachedDocument

Ejemplo

const response =
  await factus.bills.downloadAttachedDocumentXml("SETP990000203");

const xml = Buffer.from(response.data.xml_base_64_encoded, "base64").toString(
  "utf-8",
);

console.log(response.data.file_name);
console.log(xml.slice(0, 80));

En esta página