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

# Get Invoice Settlement

> Retrieve the settlement for a specific invoice

# Get Invoice Settlement

Retrieves the settlement associated with a specific invoice. Returns the most recent settlement if the invoice has been settled.

## Path Parameters

<ParamField path="id" type="string" required>
  UUID of the invoice.
</ParamField>

## Response

<ResponseField name="data" type="object">
  Settlement object. Same fields as [Get Settlement](/api-reference/settlements/get).
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl https://api.settlx.io/api/v1/invoices/a1b2c3d4-e5f6-7890-abcd-ef1234567890/settlement \
    -H "Authorization: Bearer pk_live_your_api_key"
  ```

  ```javascript Node.js theme={null}
  const invoiceId = 'a1b2c3d4-e5f6-7890-abcd-ef1234567890';
  const response = await fetch(`https://api.settlx.io/api/v1/invoices/${invoiceId}/settlement`, {
    headers: { 'Authorization': 'Bearer pk_live_your_api_key' }
  });

  if (response.status === 404) {
    console.log('Invoice not yet settled');
  } else {
    const { data } = await response.json();
    console.log(`Settlement status: ${data.status}`);
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "data": {
      "id": "d4e5f6a7-b8c9-0123-def0-456789012345",
      "invoiceId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "amount": "98.49",
      "grossAmount": "99.99",
      "currency": "USDT",
      "chain": "ethereum",
      "transactionHash": "0xdeadbeef1234567890...",
      "merchantWallet": "0xYourWallet...",
      "status": "completed",
      "initiatedAt": "2024-01-15T10:05:00.000Z",
      "completedAt": "2024-01-15T10:06:30.000Z",
      "failedAt": null,
      "createdAt": "2024-01-15T10:04:30.000Z",
      "updatedAt": "2024-01-15T10:06:30.000Z"
    }
  }
  ```

  ```json 404 theme={null}
  {
    "error": "Not Found",
    "message": "No settlement found for this invoice"
  }
  ```

  ```json 403 theme={null}
  {
    "error": "Forbidden",
    "message": "Invoice not accessible"
  }
  ```
</ResponseExample>
