Skip to content
Documentation
Get started

Invoice

Respond to your suppliers' invoices

When a supplier issues an e-invoice to your business, Timbro receives it. Your system can retrieve it, compare it with the purchase it recorded, and tell the supplier and the DGII whether the business accepts or rejects it. The DGII calls that response commercial approval, and the API calls it commercialResponse.

Use the invoicing SDK (@timbro/invoices or timbro-invoices) with an API key with Invoicing access. The key determines the business and the mode, so do not send them as filters.

import { createTimbroInvoices } from "@timbro/invoices";
const timbro = createTimbroInvoices({ apiKey: process.env.TIMBRO_INVOICES_API_KEY! });
const pending = await timbro.receivedDocuments.list({ response: "pending", limit: 20 });
const summary = pending.data[0];
const received = summary ? await timbro.receivedDocuments.retrieve(summary.id) : undefined;
if (received) {
const xml = await timbro.receivedDocuments.downloadXml(received.id);
}

Before responding, compare the XML and the supplier’s data with the purchase your system recorded. Store the received invoice’s id with that purchase.

if (received?.commercialResponse.status === "pending") {
const reviewed = await timbro.receivedDocuments.respond(received.id, { decision: "accepted" });
}

To reject it, send { decision: "rejected", motive: "The amount does not match the purchase order" }. The commercial response and its submission to the DGII have their own statuses; retrieve the received invoice to learn whether the DGII already received your response.

Responding does not record the purchase in your accounting or confirm that you paid the supplier. Your system still handles those tasks.

With HTTP, use GET /v1/received-documents?response=pending, GET /v1/received-documents/{receivedDocumentId}, and GET /v1/received-documents/{receivedDocumentId}/files/xml. Respond with POST /v1/received-documents/{receivedDocumentId}/commercial-response and the body { "decision": "accepted" } or { "decision": "rejected", "motive": "..." }.