API Reference
Invoices
Invoices are itemized bills you send to a customer. Each one has line items, tax, payment terms, an optional installment plan, and a public hosted URL your customer pays at.
LuniPay renders invoices as a hosted page and a matching PDF. Invoices transition through a state machine — DRAFT → OPEN → PAID (or VOID) — and every transition fires a webhook. Payments against an invoice append to an immutable ledger; the invoice itself stores projections.
The invoice object
idstringUnique identifier, prefixed with `inv_`.
objectstringAlways `"invoice"`.
livemodebooleanTrue if created with a live-mode key.
customer_idstringCustomer this invoice is billed to.
invoice_numberstringHuman-readable number, auto-assigned per organization.
statusstringLifecycle state. DRAFT until sent, OPEN once delivered, PAID when fully settled, VOID if cancelled.
Values: DRAFT OPEN PAID VOID UNCOLLECTIBLE
currencystringLowercase 3-letter ISO 4217 code.
subtotal_centsintegerSum of line items before tax.
tax_rate_bpsintegerTax rate in basis points (1500 = 15%).
tax_amount_centsintegerComputed tax amount.
total_centsintegerSubtotal + tax. What the customer owes.
amount_paid_centsintegerProjection over the ledger of payments received.
amount_due_centsintegerRemaining balance. Zero for PAID invoices.
payment_termsstringGrace period label shown on the invoice PDF.
Values: due_on_receipt net_7 net_15 net_30 net_60 net_90
due_datestringnullableISO date when payment is due.
notesstringnullableFree-form note shown to the customer.
line_itemsarrayItemized breakdown. Each item has `description`, `quantity`, `unit_price_cents`, `total_cents`.
installment_enabledbooleanTrue if the invoice is being paid via an installment plan.
installment_countintegernullableNumber of installments, if enabled.
hosted_invoice_urlstringPublic URL where the customer can view and pay the invoice.
metadataobjectnullableUp to 20 arbitrary key/value pairs.
sent_atintegernullableUnix timestamp when the invoice was delivered to the customer.
paid_atintegernullableUnix timestamp when the invoice was fully paid.
createdintegerCreation timestamp (unix).
updatedintegerLast-updated timestamp (unix).
{
"id": "inv_01JRZK7T9A3BXCZV2QKH5E8RMP",
"object": "invoice",
"livemode": false,
"customer_id": "cus_01JRZK2Q4T9ZS0VCNA3HX7W9EY",
"invoice_number": "INV-0042",
"status": "OPEN",
"currency": "usd",
"subtotal_cents": 10000,
"tax_rate_bps": 1500,
"tax_amount_cents": 1500,
"total_cents": 11500,
"amount_paid_cents": 0,
"amount_due_cents": 11500,
"payment_terms": "net_30",
"due_date": "2026-05-14",
"notes": "Thanks for your business.",
"line_items": [
{
"description": "Consulting — April 2026",
"quantity": 10,
"unit_price_cents": 1000,
"total_cents": 10000
}
],
"installment_enabled": false,
"installment_count": null,
"hosted_invoice_url": "https://lunipay.io/pay/inv_01JRZK7T9A3BXCZV2QKH5E8RMP",
"metadata": null,
"sent_at": null,
"paid_at": null,
"created": 1713100800,
"updated": 1713100800
}Endpoints
- POST
/v1/invoicesCreate an invoiceCreates a draft invoice that has not yet been sent.
- GET
/v1/invoices/:idRetrieve an invoiceFetches an invoice by id.
- PATCH
/v1/invoices/:idUpdate an invoiceEdits a DRAFT invoice.
- GET
/v1/invoicesList invoicesReturns a cursor-paginated list of invoices.
- POST
/v1/invoices/:id/sendSend an invoiceTransitions a DRAFT invoice to OPEN and emails it to the customer.
- POST
/v1/invoices/:id/voidVoid an invoiceCancels an unpaid invoice.