Skip to main content
Use milestones to bill one invoice in stages, such as a deposit now and the rest on delivery. Each milestone is issued on its own schedule, and your customer pays only what’s been issued. Milestone billing needs a Streamlined plan that includes it. Set an invoice’s milestones with Update invoice, and read them with Get invoice details.

Read the milestones

Get invoice details, Create invoice from order, and Update invoice all return billing_milestones, oldest first:
Send id back to change or remove a milestone. Voided milestones aren’t listed.

Change the milestones

Send billing_milestones_attributes to Update invoice. Each item changes one milestone:
  • Change one: send its id and the fields you’re changing.
  • Add one: leave out id.
  • Remove one: send its id with _destroy: true.
These rules decide what’s saved:
  • Milestones must add up to the total. Streamlined checks the milestones as they’d be after your change: the ones you send, plus every one you leave out at its saved amount. Together they must equal the invoice total, or 100% when every milestone is a percentage. Leaving a milestone out keeps it. It doesn’t remove it.
  • Issued milestones can’t change. If you change one or send it with _destroy: true, the request still gets a 200 and the milestone stays as it was. Its saved amount counts toward the total.
  • Voided milestones are skipped. They aren’t listed. If you send the id of one you read before it was voided, Streamlined skips that item and saves the rest of the request. Voided milestones don’t count toward the total.
  • Send each milestone once. Sending the same id in two items is refused with duplicate_milestone.
  • Dates you send can’t be in the past. Only the dates in an item are checked. An item with no issued_at and no due_date isn’t checked, so neither item in the example above is. An item’s due date is its due_date, or issued_at plus net_terms days when it has no due_date. Its issue and due dates must be today or later, and no earlier than those of the items before it in the request. Issued milestones keep their dates.
  • It’s all or nothing. If Streamlined refuses the request, nothing on the invoice changes, including the due date, memo, and PO number.
id can be a number or a string of the same digits. To send a single milestone, you can use one object instead of a list. _destroy removes the milestone when it’s true, "true", "1", or 1, and does nothing when it’s false, "false", "0", or empty.

When milestones are issued

issue_method decides when a milestone is issued: The API and the AI assistant tools can’t issue a milestone. When the invoice is paid in full, every milestone not yet issued is issued, without an email. That includes a SPECIFIED milestone with no issued_at. due_date is set like this:
  • When a milestone is added: a SPECIFIED milestone with an issued_at and net_terms above 0 gets issued_at plus net_terms days. Any other milestone keeps the due_date you send, or null if you don’t send one.
  • When a milestone is changed: it keeps the due_date you send. Nothing is recalculated until it’s issued.
  • When a milestone is issued: with net_terms above 0, it becomes the issue date plus net_terms days, replacing any date saved before. With net_terms of 0, it keeps its saved due_date, or becomes the issue date if there isn’t one.

Errors

When Update invoice refuses a request, it returns 422 and changes nothing. Show people error, and branch on code:
Treat any code you don’t recognize like a 422 without one: show error and don’t retry unchanged.