Hanzo
OpenapiBilling

Collect an issued invoice from credits, balance, then card

Collects an issued invoice: credit grants first, then prepaid balance, then the card on file — the same waterfall the dunning workflow runs.

POST /v1/billing/invoices/{id}/collect

Addresshttps://api.hanzo.ai/v1/billing/invoices/{id}/collect
MethodPOST
OperationcollectInvoice
AuthAuthorization: Bearer $HANZO_API_KEY

Collects an issued invoice: credit grants first, then prepaid balance, then the card on file — the same waterfall the dunning workflow runs.

A DECLINE IS NOT AN ERROR. It answers with paid=false, a reason, and the invoice still open, because a declined collection is a normal business outcome that must remain retryable — and because sealing it as a failure would wedge dunning behind a replayed decline. Only a successful collection is sealed, so a retry of a paid invoice replays the receipt instead of charging again.

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

Request

1 field.

FieldInTypeRequiredDescription
idpathstringyesID is the invoice id.

Response

StatusBodyMeaning
200Collectedok

200 body — 23 fields.

FieldInTypeAlwaysDescription
balanceUsedCentsbodyintegerBalanceUsedCents is how much was covered by prepaid balance.
cardChargedCentsbodyintegerCardChargedCents is how much was charged to the card on file.
creditUsedCentsbodyintegerCreditUsedCents is how much was covered by credit grants.
invoicebodyInvoice
invoice.amountDueCentsbodyintegerAmountDueCents is what remains collectible.
invoice.amountPaidCentsbodyintegerAmountPaidCents is what has been collected so far.
invoice.createdAtbodystringCreatedAt is when the draft was raised, RFC3339.
invoice.currencybodystringCurrency is the ISO 4217 code.
invoice.customerEmailbodystringCustomerEmail is where it is sent.
invoice.idbodystringID is the invoice id — what the issue, collect and void ops address.
invoice.linesbodyInvoiceLine[]Lines are the charges on the invoice.
invoice.lines[].amountbodyintegerAmount is the line total in whole cents (250000 is $2,500.00).
invoice.lines[].descriptionbodystringDescription is the human-readable line, e.g.
invoice.lines[].quantitybodyintegerQuantity is the number of units, when the line is metered.
invoice.lines[].unitPricebodyintegerUnitPrice is the per-unit price in cents, when the line is metered.
invoice.numberbodystringNumber is the human-facing invoice number, e.g.
invoice.paymentRefbodystringPaymentRef is the processor reference for the collection, once paid.
invoice.statusbodystringStatus is draft, open, paid, void or uncollectible.
invoice.subtotalCentsbodyintegerSubtotalCents is the sum of the lines.
invoice.userIdbodystringUserID is the customer billed.
paidbodybooleanPaid reports whether the invoice is now settled in full.
processorRefbodystringProcessorRef is the processor's reference for any card charge — the field that proves money moved at the gateway rather than only in our ledger.
reasonbodystringReason explains a decline or partial collection.

Failure carries the platform error shape — see Errors.

Examples

hanzo billing invoices collect <id>

Billing API · All Hanzo APIs · Interactive reference

How is this guide?

On this page