# Mark Invoices and Bills as Paid

You can't set an invoice or bill's status to "paid" directly through the [Accounting API](/apis/accounting/reference)
because most accounting systems (QuickBooks, Sage, NetSuite, Xero, and others) compute that status from
recorded payments rather than letting you write it. Instead, allocate a payment to the invoice or bill, and
the accounting system updates its status automatically.

## Invoices Payments

Mark an invoice as paid by allocating a payment to it, not by writing its status field directly:

1. Add a payment using the [Add Payment API](/apis/accounting/reference#tag/Payments/operation/paymentsAdd).
2. In the payment request, include the invoice details in the `allocations` object.
3. The accounting system updates the invoice status automatically based on that payment allocation.

Here's an example payment request that allocates a payment to an invoice:

```
{
  "currency": "USD",
  "currency_rate": 0.69,
  "total_amount": 49.99,
  "allocations": [
    {
      "id": "123456",
      "type": "invoice",
      "amount": 49.99
    }
  ],
  "reference": "123456",
  "payment_method": "Credit Card",
  "payment_method_reference": "123456",
  "payment_method_id": "123456",
  "accounts_receivable_account_type": "Account",
  "accounts_receivable_account_id": "123456",
  "account": {
    "id": "123456",
    "nominal_code": "N091",
    "code": "453"
  },
  "transaction_date": "2021-05-01T12:00:00.000Z",
  "customer": {
    "id": "12345",
    "display_name": "Windsurf Shop",
    "name": "Windsurf Shop"
  },
  "supplier": {
    "id": "12345",
    "display_name": "Windsurf Shop"
  },
  "reconciled": true,
  "status": "authorised",
  "type": "accounts_receivable",
  "note": "Some notes about this payment",
  "row_version": "1-12345",
  "display_id": "123456"
}
```

## Bill Payments

Mark a bill as paid the same way, by allocating a payment to it rather than writing its status field:

1. Add a payment using the [Add Bill Payment API](/apis/accounting/reference#tag/Bill-Payments/operation/billPaymentsAdd).
2. In the payment request, include the bill details in the `allocations` object.
3. The accounting system updates the bill status automatically based on that payment allocation.

Here's an example bill payment request:

```
{
  "currency": "USD",
  "currency_rate": 0.69,
  "total_amount": 1000,
  "reference": "123456",
  "payment_method": "cash",
  "payment_method_reference": "123456",
  "payment_method_id": "12345",
  "account": {
    "id": "123456",
    "nominal_code": "N091",
    "code": "453"
  },
  "transaction_date": "2021-05-01T12:00:00.000Z",
  "supplier": {
    "id": "12345",
    "display_name": "Windsurf Shop"
  },
  "company_id": "12345",
  "reconciled": true,
  "status": "authorised",
  "type": "accounts_payable",
  "allocations": [
    {
      "id": "123456",
      "type": "bill",
      "amount": 49.99,
      "allocation_id": "123456"
    }
  ],
  "note": "Some notes about this transaction",
  "number": "123456",
  "tracking_categories": [
    {
      "id": "123456",
      "name": "New York"
    }
  ],
  "custom_fields": [
    {
      "id": "2389328923893298",
      "name": "employee_level",
      "description": "Employee Level",
      "value": "Uses Salesforce and Marketo"
    }
  ],
  "row_version": "1-12345",
  "display_id": "123456",
  "pass_through": [
    {
      "service_id": "string",
      "operation_id": "string",
      "extend_object": {},
      "extend_paths": [
        {
          "path": "$.nested.property",
          "value": {
            "TaxClassificationRef": {
              "value": "EUC-99990201-V1-00020000"
            }
          }
        }
      ]
    }
  ]
}
```
