> For the complete documentation index, see [llms.txt](https://docs.alternativepayments.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.alternativepayments.io/web-sdk/components/invoice-detail.md).

# Invoice Detail

Displays detailed information about a specific invoice, including line items, amounts, and due date.

***

## Usage

```typescript
const invoiceDetail = client.components.invoiceDetail({
  containerId: 'invoice-detail',
  invoiceId: 'inv_xxx',
  onPayNow: (invoice) => {
    console.log('Pay now clicked for:', invoice.id);
  },
  onBack: () => {
    console.log('Back clicked');
  },
});
```

***

## Configuration

### InvoiceDetailConfig

| Property      | Type                         | Required | Description                      |
| ------------- | ---------------------------- | -------- | -------------------------------- |
| `containerId` | `string`                     | Yes      | ID of the container element      |
| `invoiceId`   | `string`                     | Yes      | Invoice ID to display            |
| `theme`       | `ThemeConfig`                | No       | Custom theme configuration       |
| `onPayNow`    | `(invoice: Invoice) => void` | No       | Called when "Pay Now" is clicked |
| `onBack`      | `() => void`                 | No       | Called when "Back" is clicked    |
| `onError`     | `(error: Error) => void`     | No       | Called on fetch errors           |

***

## Features

The Invoice Detail component displays:

* Invoice number with download button
* Customer information
* Due date and status
* Line items with descriptions and amounts
* Subtotal, taxes, and total amount
* Payment scheduling option (if applicable)

***

## Example

```html
<div id="invoice-detail"></div>

<script type="module">
  import { AlternativeClient } from '@getalternative/partner-sdk';

  const client = new AlternativeClient({
    clientId: 'your-client-id',
    clientSecret: 'your-client-secret',
  });

  // Get invoice ID from URL
  const invoiceId = new URLSearchParams(window.location.search).get('id');

  const detail = client.components.invoiceDetail({
    containerId: 'invoice-detail',
    invoiceId: invoiceId,
    onPayNow: (invoice) => {
      // Navigate to payment selection
      window.location.href = `/pay?invoice=${invoice.id}`;
    },
    onBack: () => {
      window.history.back();
    },
  });
</script>
```

***

## Invoice Download

The component includes a download button next to the invoice number that allows users to download the invoice as a PDF.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.alternativepayments.io/web-sdk/components/invoice-detail.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
