> Source: https://developers.terrawallet.us/docs/pay/invoices . Terra Wallet developer docs (early access).

# Invoices

An invoice is a bill with line items and a due date. Terra hosts it at `https://pay.terrawallet.us/i/inv_...` and
emails it to your customer, who pays it from their own wallet.

> **Preview.** The API is in early access and may change before launch.

## Create and send

`POST /v1/invoices`:

| Field | Type | Required | Notes |
|---|---|---|---|
| `customer_email` | string | yes | Where the invoice is sent |
| `line_items` | array | yes | Each item is `{description, quantity, unit_amount}`; `unit_amount` is a decimal string |
| `currency` | string | yes | A fiat ISO code |
| `due_date` | date | yes | When payment is due |
| `accepted_assets` | array of assets | yes | See [Payment intents](https://developers.terrawallet.us/docs/pay/payment-intents.md#assets) |

Then send it with `POST /v1/invoices/:id/send`.

```js
// Preview: create and send an invoice (Node 18 or later).
const headers = {
  Authorization: `Bearer ${process.env.TERRA_SECRET_KEY}`,
  "Content-Type": "application/json",
};

const invoice = await fetch("https://terrawallet.us/api/v1/invoices", {
  method: "POST",
  headers: { ...headers, "Idempotency-Key": "invoice-2026-0042" },
  body: JSON.stringify({
    customer_email: "billing@client.example",
    line_items: [
      { description: "Design work, November", quantity: 1, unit_amount: "1800.00" },
      { description: "Hosting", quantity: 3, unit_amount: "20.00" },
    ],
    currency: "USD",
    due_date: "2026-12-15",
    accepted_assets: [
      { chain: "ethereum", symbol: "USDC", contract: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", decimals: 6 },
      { chain: "tron", symbol: "USDT", contract: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", decimals: 6 },
    ],
  }),
}).then((r) => r.json());

await fetch(`https://terrawallet.us/api/v1/invoices/${invoice.id}/send`, { method: "POST", headers });
```

## Webhooks

- `invoice.paid`: the invoice was paid, verified on chain.
- `invoice.overdue`: the due date passed without payment.

## In the product design

The Terra Pay design also includes automatic reminders, partial payments and PDF receipts for invoices. They are
described in the API reference as they ship.
