late_fee_calc
Calculate the late fee on one overdue invoice: flat fee, monthly % or annual %, simple or compounding, with optional grace days. Returns days late, the fee, the new total and a line to paste on the invoice. Use payment_terms_check instead to work out when an invoice is due. Not legal advice; it does not look up state caps. Pure calculation: no network request, nothing is sent or stored. Costs $0.01 USDC per call via x402 (payment goes in _meta["x402/payment"]); invalid input returns an error and is not charged.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| as_of | No | Date paid, or the date to calculate to, YYYY-MM-DD (default: today, UTC) | |
| state | No | US state (2-letter) for the legal note | |
| amount | Yes | Unpaid invoice amount | |
| currency | No | ISO-4217, default USD | USD |
| due_date | Yes | Invoice due date, YYYY-MM-DD | |
| fee_type | Yes | flat = one fixed fee; monthly_percent e.g. 1.5; annual_percent e.g. 18 | |
| flat_fee | No | Flat fee; required for fee_type=flat, optional one-time add-on otherwise | |
| grace_days | No | Days after the due date before any fee applies | |
| compounding | No | false = simple interest (default); true = compounds (monthly: per 30 days; annual: daily) | |
| rate_percent | No | Rate for monthly_percent / annual_percent |