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

# Invoices

> Bill a customer from catalog products

Create products, add them to a draft invoice, then finalize to get a payment URL.

## Create a product

`amount` is minor units.

```bash theme={"theme":{"light":"min-light","dark":"poimandres"}}
curl -X POST https://api.puplar.com/products \
  -H "Authorization: Bearer sk_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Website redesign",
    "amount": 25000000,
    "currency": "ngn"
  }'
```

## Create a draft invoice

```bash theme={"theme":{"light":"min-light","dark":"poimandres"}}
curl -X POST https://api.puplar.com/invoices \
  -H "Authorization: Bearer sk_live_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": "64f1a2b3c4d5e6f7a8b9c0d1",
    "currency": "ngn",
    "lines": [{ "product": "64f9b3c4d5e6f7a8b9c0d1e2", "quantity": 1 }]
  }'
```

## Finalize

Locks the invoice and returns a hosted checkout `url`. Status becomes `open`.

```bash theme={"theme":{"light":"min-light","dark":"poimandres"}}
curl -X POST https://api.puplar.com/invoices/64f1a2b3c4d5e6f7a8b9c0d1/finalize \
  -H "Authorization: Bearer sk_live_your_key"
```

Email it with `POST /invoices/{id}/send`. Void an open invoice with `POST /invoices/{id}/void`. Delete drafts; do not void them.

Listen for `invoice.finalized`, `invoice.sent`, `invoice.paid`, and `invoice.voided`. See [Webhooks](/guides/webhooks).

```json theme={"theme":{"light":"min-light","dark":"poimandres"}}
{
  "id": "64f1a2b3c4d5e6f7a8b9c0d1",
  "type": "invoice.paid",
  "timestamp": "2026-07-26T12:00:00.000Z",
  "payload": {
    "id": "64f9b3c4d5e6f7a8b9c0d1e2",
    "number": "INV-00012",
    "status": "paid",
    "livemode": true,
    "customer_id": "64aa11b2c3d4e5f6a7b8c9d0",
    "amount": 25000000,
    "currency": "ngn",
    "lines": [
      {
        "product": "64dd44e5f6a7b8c9d0e1f2a3",
        "name": "Website redesign",
        "quantity": 1,
        "unit_amount": 25000000,
        "amount": 25000000
      }
    ],
    "due_date": null,
    "metadata": {},
    "transaction_id": "64bb22c3d4e5f6a7b8c9d0e1",
    "paid_at": "2026-07-26T12:00:00.000Z"
  }
}
```
