How Payments Are Allocated Across Invoices
Source: autosoft-workshop/app/models/customer_payment.rb
- Payment is applied to invoices in created_on DESC order (newest first)
- Overpayment on ANY invoice blocks the entire payment from processing
- Payments synced to Xero cannot be deleted even if sync failed
- Background Xero/MYOB/Sage sync can fail silently — payment shows processed locally but not in accounting
Support scenarios
- "Payment went to wrong invoice" → allocation order is newest-first, not oldest
- "Can't delete payment" → it has a Xero ID or status is not 'open'
- "Xero doesn't show payment" → background sync failed, no error shown to user