Skip to Content

Invoicing

Every milestone in an active project generates an invoice. The invoice workflow tracks the lifecycle of each payment from draft through approval to settlement, with structured paths for disputes and rejections.

Flow

Invoice Creation

The expert raises an invoice against a milestone (invoices are not auto-created on milestone completion). It inherits its financial values from the parent quote:

FieldCalculationDescription
amountquote.amount × (milestone.percentage / 100)Expert’s share for this milestone
totalamountTotal amount associated with this invoice

One invoice is created per milestone — enforced by a unique index on milestone. This means each milestone can only ever have one invoice, preventing duplicate billing.

Disputing an invoice also raises a delivery blocker on the engagement, so the dispute is visible in the team’s blocker queue until it is resolved (resolution returns the invoice to invoice_draft).

Invoice Status Workflow

StatusTransition TypeMeaning
invoice_draftRaised by the expert against a milestone; awaiting manager approval
invoice_sentpositiveApproved by the manager; with the customer awaiting payment
invoice_disputednegativeManager has flagged an issue; loops back to draft after resolution
invoice_paidpositivePayment confirmed; project value released
invoice_rejectednegativeInvoice rejected outright; terminal state

Payment Recording

When an invoice is marked as paid:

  • paid = true is set on the invoice record
  • paidAt is required and must be provided — the model validates that paidAt exists whenever paid is true
  • isApproved = true is set to indicate the full approval and payment cycle is complete

These flags are also surfaced as computed virtuals on the parent milestone (isPaid, isApproved), allowing milestone progress to be derived without joining the invoice collection.

Invoice Fields

FieldTypeDescription
quoteQuote refThe quote this invoice is billed against
milestoneMilestone refThe completed milestone this invoice covers (unique)
leadLead refThe originating lead
expertUser refThe expert being paid
customerUser refThe customer being billed
managerUser refThe CSM managing the invoice
vendorUser refThe vendor account
amountNumberExpert payment for this milestone
totalNumberTotal amount
statusStringCurrent invoice status name
paidBooleanWhether payment has been received
paidAtDateRequired when paid = true
dueDateDateOptional payment due date; falls back to the linked milestone’s due date when unset

Notifications

Key invoice events trigger platform notifications to the relevant parties:

EventNotification KeyRecipients
Invoice raisedinvoice-raisedManager, Customer
Invoice approvedinvoice-approvedExpert
Invoice disputedinvoice-disputedExpert
Invoice rejectedinvoice-rejectedExpert
Payment confirmedinvoice-paidExpert, Customer
Last updated on