> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tesouro.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Invoice reconciliation

> Learn how to send automated reminders about overdue invoices to customers.

## 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](/finops/guides/common/payment-records#get-all-payment-records-for-a-payable-or-receivable).

<Info>
  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](/finops/guides/accounts-receivable/invoices/manage#using-external-payment-links).
</Info>

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](/finops/guides/common/payment-records#create).

Upon reconciliation, Tesouro updates the invoice with the latest payment information and automatically transitions the invoice to the appropriate status.

<Info>
  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`.
</Info>
