A recurring template cannot produce an invoice with a negative total
Negative line totals on a template, a generated invoice adding up below zero, and editing a draft to a negative total are now rejected.
A negative standard or simplified invoice is a corrective in disguise: BeeL. handles negative amounts only as a corrective that points at the invoice it corrects. Creating one was already refused, but a recurring template could still generate one, and a draft could be edited into one. Both are closed now.
Correctives are unaffected: a negative total is normal there.
What breaks
total_excluding_taxandtotal_including_taxon a template line must be 0 or more. A negative one answers422 VALIDATION_ERRORwith the field indetails, on create and update, where it used to be accepted.- Editing a draft so that its total goes below zero answers
422 NEGATIVE_TOTAL_REQUIRES_RECTIFICATIVE, the same answer creating it would get. Negative lines are still allowed as long as the total is not negative. - A template whose lines add up below zero no longer generates. The run fails permanently and the template is paused, with
recurring_invoice.paused, instead of issuing a negative invoice.
Does this affect you?
- Look for templates with a line whose declared total is negative, such as a discount written as its own line. Keep the total at 0 or above, or apply the discount as
discount_percentage.
What else changed
- A template whose series is inactive, deleted or of the wrong type is paused as well, and so is one with no default series to fall back on. It used to be retried every night without ever succeeding.
Endpoints
- POST|PUT|PATCH/v1/companies/{company_id}/recurring-invoicesNegative line totals answer 422 VALIDATION_ERROR
- PATCH/v1/companies/{company_id}/invoices/{invoice_id}A draft edited to a negative total answers 422 NEGATIVE_TOTAL_REQUIRES_RECTIFICATIVE
Where to go next
Recurring templates say when they are failing, and which period they last invoiced
`is_failing` flags a template from its first failed run, and `last_generated_scheduled_date` gives the latest period it has already invoiced.
Discarding or resolving a payment event acts on the whole charge
`discard`, `restore` and `resolve` on a payment event now also apply to the other events of the same charge: its failed attempts, its refunds, its dispute.