Invoices
Bill a customer for line items; they pay online from the invoice’s page.
Watenga computes the totals (tax and discounts included), numbers the invoice, emails it with a payment link and reminds the customer. Partial payments and offline payments you record are kept against the balance.
Keys and scopes
invoices scope.Create and send an invoice
unit_price is a decimal string; the invoice’s total, amount_due and payment_url come back computed.
const invoice = await watenga.invoices.create({
title: 'October retainer',
customer_name: 'Ada Buyer',
customer_email: 'ada@example.com',
currency: 'USD',
line_items: [{ description: 'Design work', quantity: 10, unit_price: '45.00' }],
due_date: '2026-11-15',
});
await watenga.invoices.send(invoice.id);Follow payment
List by status (draft, sent, viewed, partial, paid, overdue, cancelled, void), remind, or void an invoice that should not be paid.
for await (const inv of watenga.invoices.listAll({ status: 'overdue' })) {
await watenga.invoices.remind(inv.id);
}Webhook events
| Event | When |
|---|---|
invoicing.invoice.sent | The invoice was emailed |
invoicing.invoice.partially-paid | Part of the balance was paid |
invoicing.invoice.paid | Paid in full |
invoicing.invoice.unpaid | The due date passed with a balance |
invoicing.invoice.cancelled | Voided or cancelled |
Each event carries the object in data.object; verify the signature first (Webhooks).
Test it
Use a test secret key (sk_test_…): it never moves money. Pay with the test cards and wallet numbers, and receive the webhooks on your machine with watenga listen --forward-to http://localhost:3000/webhooks (CLI).
An overdue invoice without waiting: advance the test clock past its due date and run POST /v1/developer/sandbox/clock/tick.
Related: Quotations · Customers