factus-js iconfactus-js
Notas crédito

Descargar AttachedDocument XML

Descargar el AttachedDocument XML de una nota crédito.

Firma del método

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

Endpoint Factus

GET /v2/credit-notes/{number}/download-attached-document-xml

Fuente oficial: Descargar XML AttachedDocument

Ejemplo

const response = await factus.creditNotes.downloadAttachedDocumentXml("NC856");

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