How to Distribute Invoice Payments to Milestones
When an invoice contains multiple milestones, you can distribute the payment amount across them. Here's how it works:
When Distribution Dialog Appears
The payment distribution dialog appears when:
- An invoice has multiple milestones linked
- An invoice has both milestone and non-milestone line items
- You mark an invoice as "Paid"
Using the Distribution Dialog
In the distribution dialog, you'll see:
- List of all milestones in the invoice
- Total amount for each milestone
- Input fields to allocate payment amounts
- Total invoice amount
- Remaining amount indicator
Distributing Payments
To distribute payments:
- Enter the amount to allocate to each milestone
- The system shows remaining amount as you allocate
- Ensure the total allocation equals the invoice total
- Click "Distribute Payment" to save
Discount Calculation
For each milestone, the discount is automatically calculated as:
- Discount = Total Milestone Amount - Allocated Payment Amount
- This accounts for any discounts applied at the invoice level
- The discount is stored with the milestone for tracking
Payment Status
After distribution, milestones are updated:
- amount_paid: Set to the allocated amount
- discount: Calculated automatically
- paid status: Updated based on (amount_paid + discount) vs total amount
Special Cases
The distribution dialog doesn't appear when:
- Invoice has no milestones
- Invoice has only one milestone line item
- In these cases, payment is automatically applied
Manual Distribution
You can also manually distribute payments via the API endpoint:
- Use
/invoices/distribute-milestone-payments - Provide invoice ID and distribution amounts
- Useful for programmatic updates or bulk operations
💡 Tip:
Distribute payments proportionally based on milestone amounts, or allocate based on what was actually paid for each milestone. The system tracks everything automatically.