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

# Mark Invoice as Paid

Marks an invoice as paid without creating a payment through a payment provider. Use this when recording payments received outside of Alguna (e.g., bank transfers, cheques, or cash).

If you have a customer-facing invoice reference number instead of an Alguna invoice ID, use the [Invoice Lookup](/api-reference/invoices/invoiceLookup) endpoint first to resolve it.

## Params

<ParamField path="id" type="string" required>
  The Alguna ID of the invoice to mark as paid.
</ParamField>

## Request Body

All fields are optional. When omitted, sensible defaults are applied (full invoice amount, current date).

<ParamField body="amountPaid" type="string">
  The amount paid as a decimal string. Defaults to the full invoice total when omitted.
</ParamField>

<ParamField body="paidDate" type="string">
  The date the payment was received. (RFC 3339 formatted timestamp). Defaults to the current date when omitted.
</ParamField>

<ParamField body="externalPaymentSource" type="string">
  The source of the external payment. One of: `bank_transfer`, `cheque`, `payment_card`, `cash`, `other`.
</ParamField>

<ParamField body="externalPaymentNote" type="string">
  A free-text note describing the payment (e.g., a bank reference or cheque number).
</ParamField>

## Response

Returns the full invoice object with its status updated to `paid`.

<ResponseField name="id" type="string">
  The Alguna ID of the invoice.
</ResponseField>

<ResponseField name="accountId" type="string">
  The Alguna ID of the account associated with the invoice.
</ResponseField>

<ResponseField name="status" type="string">
  The status of the invoice. Will be `paid` after a successful call.
</ResponseField>

<ResponseField name="dueDate" type="string">
  The due date of the invoice. (RFC 3339 timestamp)
</ResponseField>

<ResponseField name="issueDate" type="string">
  The date when the invoice was issued. (RFC 3339 timestamp)
</ResponseField>

<ResponseField name="billingPeriodStart" type="string">
  The start date of the billing period for the invoice. (RFC 3339 timestamp)
</ResponseField>

<ResponseField name="billingPeriodEnd" type="string">
  The end date of the billing period for the invoice. (RFC 3339 timestamp)
</ResponseField>

<ResponseField name="billingPeriod" type="string">
  The formatted billing period for the invoice.
</ResponseField>

<ResponseField name="currency" type="string">
  The ISO 4217 currency in which the invoice is billed.
</ResponseField>

<ResponseField name="description" type="string">
  The description of the invoice.
</ResponseField>

<ResponseField name="subtotal" type="string">
  The subtotal amount of the invoice as a decimal string.
</ResponseField>

<ResponseField name="tax" type="string">
  The tax amount of the invoice as a decimal string.
</ResponseField>

<ResponseField name="total" type="string">
  The total amount of the invoice as a decimal string.
</ResponseField>

<ResponseField name="amountPaid" type="string">
  The amount that has been paid for the invoice as a decimal string.
</ResponseField>

<ResponseField name="amountRemaining" type="string">
  The remaining amount to be paid for the invoice as a decimal string.
</ResponseField>

<ResponseField name="createdAt" type="datetime">
  The date and time at which the invoice was created.
</ResponseField>

<ResponseField name="updatedAt" type="datetime">
  The date and time at which the invoice was last updated.
</ResponseField>

## Example

<RequestExample>
  ```bash cURL theme={null}
  curl --request PUT \
    --url 'https://api.alguna.io/invoices/inv_abc123def456/mark-as-paid' \
    --header 'Authorization: Bearer YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
      "amountPaid": "1500.00",
      "paidDate": "2025-01-15T00:00:00Z",
      "externalPaymentSource": "bank_transfer",
      "externalPaymentNote": "Wire transfer ref: TXN-98765"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "inv_abc123def456",
    "accountId": "acct_xyz789",
    "status": "paid",
    "dueDate": "2025-01-31T00:00:00Z",
    "issueDate": "2025-01-01T00:00:00Z",
    "billingPeriodStart": "2025-01-01T00:00:00Z",
    "billingPeriodEnd": "2025-01-31T00:00:00Z",
    "billingPeriod": "January 1, 2025 - January 31, 2025",
    "currency": "USD",
    "description": "Invoice for period January 1, 2025 to January 31, 2025",
    "subtotal": "1500.00",
    "tax": "0.00",
    "total": "1500.00",
    "amountPaid": "1500.00",
    "amountRemaining": "0.00",
    "createdAt": "2025-01-01T00:00:00Z",
    "updatedAt": "2025-01-15T12:00:00Z"
  }
  ```
</ResponseExample>
