> ## 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.

# Payment terms

> Learn how to set the amount of time to pay an invoice and to include discounts for early payments.

## Overview

Payment terms define the timeframe within which one has to pay an [invoice](/finops/support/glossary#invoice) (for example, 30 days from the invoice issue date). The terms can optionally include discounts for early payments—early payment discounts—to motivate the customers to pay sooner than the due date.

## Payment terms structure

Tesouro's payment terms structure has three tiers. The first two tiers—`term_1` and `term_2`— represent early discount dates and can include discounts. The final tier—`term_final`—is required in all payment terms. This tier defines the invoice's due date and does not support discounts.

The `number_of_days` field on the first two tiers represents the days after issuing the invoice that each early discount date no longer applies. The `number_of_days` field on the final tier shows the days after issuance that invoice becomes overdue.

The payment terms are represented as follows:

```json expandable lines theme={null}
{
  // User-defined display name
  "name": "2/10, 1/20, net 30",

  // Optional description
  "description": "To be paid within 30 days. 2% discount if paid within 10 days, 1% discount if paid within 20 days.",

  // Payment target dates and discounts.
  // term_1 and term_2 are optional early discount terms. The final term does not have a discount.
  // Condition: term_1 days < term_2 days < term_final days
  "term_1": {
    "number_of_days": 10, // Days after the invoice issue date
    "discount": 200 // Discount percentage in minor units. Here, 200 means 2%. 1050 means 10.5%.
  },
  "term_2": {
    "number_of_days": 20,
    "discount": 100
  },
  "term_final": {
    "number_of_days": 30
  }
}
```

The `term_1` and `term_2` fields are optional tiers when creating or updating payment terms. The `term_final` field is a required tier and does not support discounts.

`term_1.number_of_days` must be lower than `term_2.number_of_days`. These fields represent the final days to access any early payment discounts. Both fields must be lower than the `term_final.number_of_days` field.

## Examples

### Net X

A common payment term is "Net X" (such as Net 7 or Net 30) which means the invoice must be fully paid within X days. To create such a payment term, use the following payload:

```json lines theme={null}
{
  "name": "Net 30",
  "description": "Payment is due within 30 days after the invoice issue date",
  "term_final": {
    "number_of_days": 30
  }
}
```

### Early payment discounts

To incentivize quick payments, payment terms can include early payment discounts. You can define **up to two discount tiers** before the due date.

For example, payment terms can offer 1 percent off the invoice amount if the customer pays within 15 days as opposed to 30. This scenario, commonly abbreviated as "1/15, Net 30", can be expressed as follows:

```json lines theme={null}
{
  "name": "1/15, Net 30",
  "description": "The invoice must be paid within 30 days. 1% discount if paid within the first 15 days.",
  "term_1": {
    "number_of_days": 15,
    "discount": 100
  },
  "term_final": {
    "number_of_days": 30
  }
}
```

The following example includes two discount tiers:

```json lines theme={null}
{
  "name": "2/10, 1/20, Net 30",
  "description": "The invoice must be paid within 30 days. 2% discount if paid within the first 10 days, 1% discount if paid within 20 days.",
  "term_1": {
    "number_of_days": 10,
    "discount": 200
  },
  "term_2": {
    "number_of_days": 20,
    "discount": 100
  },
  "term_final": {
    "number_of_days": 30
  }
}
```

## Payment terms for receivables

You must have configured at least one payment term before you can create [outgoing invoices](/finops/guides/accounts-receivable/invoices/create).

### Step 1. Create payment terms

To create a new payment term, call [`POST /payment-terms`](/finops/reference/openapi/payment-terms/post-payment-terms) and provide the terms data in the request body (see the [examples](#examples) above):

```sh lines theme={null}
curl -X POST 'https://api.sandbox.tesouro.com/v1/payment-terms' \
     -H 'X-Finops-Version: 2025-06-23' \
     -H 'X-Organization-Id: ORGANIZATION_ID' \
     -H 'Authorization: Bearer ACCESS_TOKEN' \
     -H 'Content-Type: application/json' \
     -d '{
       "name": "Net 30",
       "term_final": {
         "number_of_days": 30
       }
     }'
```

The successful 201 response contains the `id` assigned to the created payment term. You will need this `id` later when creating the outgoing invoices.

```json lines theme={null}
{
  "id": "411d9079-02af-476d-8723-4789882e01c3"
  ...
}
```

### Step 2. Specify payment terms when creating an invoice

When creating an outgoing invoice, you must provide the ID of the payment term to use for this invoice:

```sh lines theme={null}
curl -X POST 'https://api.sandbox.tesouro.com/v1/receivables' \
     -H 'X-Finops-Version: 2025-06-23' \
     -H 'X-Organization-Id: ORGANIZATION_ID' \
     -H 'Authorization: Bearer ACCESS_TOKEN' \
     -H 'Content-Type: application/json' \
     -d '{
       "type": "invoice",
       "line_items": [ ... ],
       "payment_terms_id": "411d9079-02af-476d-8723-4789882e01c3",
       ...
     }'
```

The invoice due date is calculated based on the invoice creation date and the `term_final` period of the payment terms. The invoice's due date is returned in the `due_date` field on the invoice response object. The `payment_terms` object returned in the response also includes the calculated `end_date` for each term period.

```json expandable lines theme={null}
{
  "type": "invoice",
  "created_at": "2024-05-19T09:12:53.875094+00:00",
  ...
  "due_date": "2024-06-18",
  "payment_terms": {
    "id": "411d9079-02af-476d-8723-4789882e01c3",
    "name": "1/15, Net 30",
    "description": "The invoice must be paid within 30 days. 1% discount if paid within the first 15 days.",
    "term_1": {
      "number_of_days": 15,
      "discount": 100,
      "end_date": "2024-06-03"   // Last date to qualify for an early payment discount
    },
    "term_final": {
      "number_of_days": 30,
      "end_date": "2024-06-18"   // Invoice due date
    }
  }
}
```

Additionally, the invoice response contains both the total invoice amount and the amount adjusted for the currently effective early payment discount, if any. For example, the following response shows an invoice with the `amount_to_pay` field reflecting a 1% early payment discount defined in the payment term :

```json lines theme={null}
{
  "type": "invoice",
  ...
  "total_amount": 5000,
  "amount_to_pay": 4950
}
```

You can change the terms for an existing draft outgoing invoice by calling [`PATCH /receivables/{invoice_id}`](/finops/reference/openapi/receivables/patch-receivables-id):

```sh lines theme={null}
curl -X PATCH 'https://api.sandbox.tesouro.com/v1/receivables/{invoice_id}' \
     -H 'X-Finops-Version: 2025-06-23' \
     -H 'X-Organization-Id: ORGANIZATION_ID' \
     -H 'Authorization: Bearer ACCESS_TOKEN' \
     -H 'Content-Type: application/json' \
     -d '{
       "invoice": {
         "payment_terms_id": "<new ID>"
       }
     }'
```

### List all payment terms for receivables

To get all configured payment terms for receivables, call [`GET /payment-terms`](/finops/reference/openapi/payment-terms/get-payment-terms):

```sh lines theme={null}
curl -X GET 'https://api.sandbox.tesouro.com/v1/payment-terms' \
     -H 'X-Finops-Version: 2025-06-23' \
     -H 'X-Organization-Id: ORGANIZATION_ID' \
     -H 'Authorization: Bearer ACCESS_TOKEN'
```

## Payment terms for payables

In [payables](/finops/support/glossary#payable), the payment terms are determined by the organization's [counterparts](/finops/support/glossary#counterpart), that is, vendors or suppliers.

When [creating a payable from data](/finops/guides/accounts-payable/payables/collect#create-a-payable-from-data), you can specify the `payment_terms` data in the request body as shown below:

```sh expandable lines theme={null}
curl -X PATCH 'https://api.sandbox.tesouro.com/v1/payables' \
     -H 'X-Finops-Version: 2025-06-23' \
     -H 'X-Organization-Id: ORGANIZATION_ID' \
     -H 'Authorization: Bearer ACCESS_TOKEN' \
     -H 'Content-Type: application/json' \
     -d '{
       "currency": "USD",
       "amount": 11900,
       "due_date": "2022-06-30",
       "counterpart_name": "SupplierName",
       "payment_terms": {
         "name": "2/10, 1/20, net 30",
         "term_1": {
           "number_of_days": 10,
           "discount": 200
         },
         "term_2": {
           "number_of_days": 20,
           "discount": 100
         },
         "term_final": {
           "number_of_days": 30
         }
       },
       ...
     }'
```
