Hanzo
OpenapiBilling

Raise a draft invoice against a customer

Raises a DRAFT invoice against a customer in the caller's own org.

POST /v1/billing/invoices

Addresshttps://api.hanzo.ai/v1/billing/invoices
MethodPOST
OperationraiseInvoice
AuthAuthorization: Bearer $HANZO_API_KEY

Raises a DRAFT invoice against a customer in the caller's own org.

The invoice is not collectible yet: a draft exists so it can be read and corrected, and issueInvoice is the separate act that turns it into a demand for payment. The subtotal and amount due are computed from the lines, so there is no total to send and none to get wrong.

The billing org is the caller's, taken from the validated principal, so an invoice can only ever be raised on the caller's own books.

A named handler, not a closure, so zipdoc can lift this prose into the registry.

Request

8 fields, body application/json (required).

FieldInTypeRequiredDescription
currencybodystringCurrency is the ISO 4217 code, lower-cased.
customerEmailbodystringCustomerEmail is where the invoice is sent.
linesbodyInvoiceLine[]Lines are the charges. The invoice subtotal and amount due are COMPUTED from these — there is no total field to send, because a total that disagreed with its…
lines[].amountbodyintegerAmount is the line total in whole cents (250000 is $2,500.00).
lines[].descriptionbodystringDescription is the human-readable line, e.g.
lines[].quantitybodyintegerQuantity is the number of units, when the line is metered.
lines[].unitPricebodyintegerUnitPrice is the per-unit price in cents, when the line is metered.
userIdbodystringUserID identifies the customer being billed, within the caller's own org.

Response

StatusBodyMeaning
201Invoicecreated

201 body — 16 fields.

FieldInTypeAlwaysDescription
amountDueCentsbodyintegerAmountDueCents is what remains collectible.
amountPaidCentsbodyintegerAmountPaidCents is what has been collected so far.
createdAtbodystringCreatedAt is when the draft was raised, RFC3339.
currencybodystringCurrency is the ISO 4217 code.
customerEmailbodystringCustomerEmail is where it is sent.
idbodystringID is the invoice id — what the issue, collect and void ops address.
linesbodyInvoiceLine[]Lines are the charges on the invoice.
lines[].amountbodyintegerAmount is the line total in whole cents (250000 is $2,500.00).
lines[].descriptionbodystringDescription is the human-readable line, e.g.
lines[].quantitybodyintegerQuantity is the number of units, when the line is metered.
lines[].unitPricebodyintegerUnitPrice is the per-unit price in cents, when the line is metered.
numberbodystringNumber is the human-facing invoice number, e.g.
paymentRefbodystringPaymentRef is the processor reference for the collection, once paid.
statusbodystringStatus is draft, open, paid, void or uncollectible.
subtotalCentsbodyintegerSubtotalCents is the sum of the lines.
userIdbodystringUserID is the customer billed.

Failure carries the platform error shape — see Errors.

Examples

hanzo billing invoices create

Billing API · All Hanzo APIs · Interactive reference

How is this guide?

On this page