Skip to main content

Overview

Invoice reconciliation ensures that an invoice’s payment history matches the payment records within Tesouro systems. This involves updating payment amounts and invoice status to reflect the latest transaction data. This page explains how Tesouro handles reconciliation for invoices with internal or external payment rails.

How it works

When creating or issuing an invoice, you can choose between using Tesouro’s internal payment rails or payment rails provided by an external payment provider. Tesouro systems automatically reconcile payment records for invoices paid using our internal payment rails. However, when using external payment rails, you must manually provide details of payments made towards an invoice for Tesouro to record and reconcile. When using Tesouro payment rails, the organization must connect a payment link to the invoice using the POST payment_link endpoint. Upon issuing the invoice, the counterpart will receive the payment link generated for the invoice. The counterpart can then make a payment by accessing this link via email or the invoice’s QR code. After the payment transaction is completed, Tesouro automatically updates the invoice and stores the invoice’s payment information. The invoice’s status is also updated to paid. You can retrieve the payment information for the invoice by making a GET request to the /payment-records endpoint and including the object_id query parameter. This parameter accepts the invoice UUID as its value. For more information, see Get all payment records for a receivable.
Counterparts can only make full payments using Tesouro payment rails. Partial payments are only supported for invoices using external payment rails. For more information, see Using external payment links.
On the other hand, when using external payment rails, the organization must provide the link to the external payment page for the invoice. When a counterpart makes a payment, the organization must send information about the payment—full or partial—to Tesouro by making a POST request to the payment_records endpoint. The request must include information about the invoice and its payment information. For more information, see Create a payment record. Upon reconciliation, Tesouro updates the invoice with the latest payment information and automatically transitions the invoice to the appropriate status.
Counterparts can make partial payments when using external payment rails. To reconcile the payment records, make a POST request to the payment_records endpoint and provide the amount paid by the counterpart. Tesouro will automatically update the amount_due field on the invoice and transition the invoice status to partially_paid.

Payments in the invoice history

Recording a payment is what puts payment details into the invoice’s document history. When Tesouro applies a succeeded payment record to an invoice, it adds a payment_received event carrying five values from that payment record: payment_record_id, payment_intent_id, payment_method, paid_at, and is_external. A payment made over Tesouro payment rails carries all five values. A payment that an organization user records by hand carries only what their POST /payment-records call supplied, so payment_intent_id and payment_method are often null. A payment_record_id in the invoice history always points to a payment record that exists. Tesouro commits the payment record before it updates the invoice, so GET /payment-records/{payment_record_id} returns that record to any caller with the payment_record permission. If the payment record cannot be written, Tesouro makes no change to the invoice, which keeps its previous status and amounts.

Reconciling payables

The same payment records reconcile payables. Create a payment record with object.type set to payable to record a payment made towards a bill, and Tesouro updates the payable’s status and amounts the same way. The payment details then appear in the payable history.

See also