# Payment Terms

> Configure payment terms for invoices and bills.

- **Category:** Guides
- HTML version: https://www.ondayzero.com/docs/guides/payment-terms
- All guides: https://www.ondayzero.com/docs/guides/index.md
- Endpoint catalog: https://www.ondayzero.com/docs/reference/index.md

---

# Payment Terms

Payment terms set how many days a customer or vendor has to pay (Net 30, Due on Receipt) and can carry an early-payment discount (2/10 Net 30). Use them as defaults on customers and vendors and record them on invoices and bills.

> The Payment Terms page is switched off in the DayZero app for now and new businesses start with no terms, but these endpoints work. Load the standard set with [Seed defaults](#seed-defaults).

All requests need `Authorization: Bearer dz_…` and `x-business-id`. `GET` needs read access, `POST` and `PUT` write access, `DELETE` delete access. Successful responses are wrapped as `{"success": true, "data": …}`; the examples below show `data`.

## Create a payment term

`POST /api/v1/payment-terms` returns `201`.

```bash
curl -X POST "https://api.ondayzero.com/api/v1/payment-terms" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "2/10 Net 30",
    "days_until_due": 30,
    "discount_percent": 2.0,
    "discount_days": 10
  }'
```

```json
{
  "id": "019a0c3e-7d2a-7c41-9a5e-2f6b1d8e4c10",
  "business_id": "019a0b11-4e6f-7a20-8c3d-5b9e2a7f1d44",
  "name": "2/10 Net 30",
  "days_until_due": 30,
  "discount_percent": 2.0,
  "discount_days": 10,
  "is_default": false,
  "is_active": true,
  "created_at": "2026-10-14T15:02:11Z",
  "updated_at": "2026-10-14T15:02:11Z"
}
```

| Field | Type | Description |
|-------|------|-------------|
| `name` | string | Display name (required) |
| `days_until_due` | integer | Days after the issue date until payment is due (required, `>= 0`; `0` = due on receipt) |
| `discount_percent` | number | Early-payment discount, `0` to `100` (e.g. `2.0` for 2%). Planning only, see [Early-payment discounts](#early-payment-discounts) |
| `discount_days` | integer | Days within which the discount applies (`>= 0`) |
| `is_default` | boolean | Make this the business default term; clears the previous default (default `false`) |

## List payment terms

```bash
curl "https://api.ondayzero.com/api/v1/payment-terms?active_only=true&limit=50" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID"
```

`active_only` defaults to `true`; pass `false` to include deactivated terms. Terms are sorted by `days_until_due`. The list is cursor-paginated: `data` holds `items`, `has_next` and `next_cursor`; pass `next_cursor` back as `cursor` for the next page (see [Pagination](/docs/guides/pagination)).

`GET /api/v1/payment-terms/{term_id}` returns one term.

## Get the default term

```bash
curl "https://api.ondayzero.com/api/v1/payment-terms/default" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID"
```

Returns `404` when no active term is the default.

## Seed defaults

Loads the standard set when the business has no terms yet:

| Term | `days_until_due` | Discount |
|------|------------------|----------|
| Due on Receipt | 0 | — |
| Net 10 | 10 | — |
| Net 15 | 15 | — |
| Net 30 (default) | 30 | — |
| Net 45 | 45 | — |
| Net 60 | 60 | — |
| Net 90 | 90 | — |
| 2/10 Net 30 | 30 | 2% within 10 days |

```bash
curl -X POST "https://api.ondayzero.com/api/v1/payment-terms/seed-defaults" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID"
```

If the business already has any terms, active or not, nothing is created and the existing terms are returned, so the call is safe to repeat.

## Update a payment term

`PUT /api/v1/payment-terms/{term_id}`. Every field is optional; send only what changes.

```bash
curl -X PUT "https://api.ondayzero.com/api/v1/payment-terms/{term_id}" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID" \
  -H "Content-Type: application/json" \
  -d '{"days_until_due": 45, "is_default": true}'
```

- `name`, `days_until_due`, `discount_percent`, `discount_days`, `is_default`, `is_active` are accepted.
- `null` for `name`, `days_until_due`, `is_default` or `is_active` leaves the field as it is. `null` for `discount_percent` or `discount_days` clears it.
- `"is_active": false` retires the term and also clears its default flag; `true` brings it back.
- New days only affect documents created afterwards; existing due dates don't move.

## Deactivate a payment term

```bash
curl -X DELETE "https://api.ondayzero.com/api/v1/payment-terms/{term_id}" \
  -H "Authorization: Bearer dz_your_token_here" \
  -H "x-business-id: YOUR_BUSINESS_ID"
```

The term is deactivated (`is_active: false`, `is_default: false`), not deleted. Customers, vendors and documents that reference it keep it; it drops out of `active_only=true` lists.

## Terms on customers, vendors, invoices and bills

| Where | Field | Behaviour |
|-------|-------|-----------|
| Customer, vendor | `default_payment_term_id` | Default term for their new documents. Must be a term of this business, otherwise `404`. |
| Invoice create / update (`POST /api/v1/invoices`, `PUT /api/v1/invoices/{invoice_id}`) | `payment_term_id` | The term the invoice was issued under. Recorded for reference; it does not set or move `due_date`. On update, `null` clears it. |
| Bill create / update (`POST /api/v1/bills`, `POST /api/v1/bills/received`, `PUT /api/v1/bills/{bill_id}`) | `payment_term_id` | The term the vendor billed under. Recorded for reference; it does not set or move `due_on`. Editable on any bill that isn't canceled, including paid ones. On update, `null` clears it. |
| Purchase order | `payment_term_id` | Defaults to the vendor's default term. |

A `payment_term_id` must belong to the business, otherwise the request returns `404`. A deactivated term is still accepted, so a document keeps the term it was issued under. Invoice and bill responses return `payment_term_id`.

Send the due date yourself (`due_date` on invoices, `due_on` on bills). For example, to issue an invoice under Net 30 dated 2026-10-14:

```json
{
  "customer_id": "019a0b2c-1f3e-7b55-9d02-6c4a8e1b7f90",
  "due_date": "2026-11-13",
  "payment_term_id": "019a0c3e-7d2a-7c41-9a5e-2f6b1d8e4c11",
  "line_items": [
    {"variant_id": "custom", "description": "October retainer", "unit_price": 250000, "quantity": 1}
  ]
}
```

## Early-payment discounts

`discount_percent` and `discount_days` are planning information. A bill recorded under a discount term shows the saving in the **Pay plan** tab on Bills while the discount window is open and the bill has no payments or credits, and payment suggestions and the reorder cash planner can use it. DayZero never takes the discount off an invoice or bill total, or off what is charged or booked. Record the payment for the amount actually paid.

## Errors

| Status | Code | When |
|--------|------|------|
| `404` | `NOT_FOUND_001` | The term doesn't exist or belongs to another business; no default term (`/default`); a `payment_term_id` or `default_payment_term_id` from another business |
| `400` | `GEN_002` | Validation: missing `name` or `days_until_due`, `days_until_due` or `discount_days` below `0`, `discount_percent` outside `0`–`100` |
| `401` / `403` | — | Missing or invalid token, or the key lacks the permission for the method |
