Commerce Accounts Receivable
Track customer receivables, manage collections, issue credit memos, and monitor AR aging.
How It Works
- Monitor AR aging to identify overdue accounts.
- Log collection activities (dunning letters, calls, emails).
- Issue credit memos for returns, pricing errors, or goodwill.
- Apply payments and credit memos to outstanding invoices.
- Write off uncollectible balances with approval.
- Generate customer statements.
Usage
- CLI:
stateset ar ... or stateset "AR aging report"
- Writes require
--apply.
- MCP tools:
get_ar_aging, get_customer_ar_aging, log_collection_activity, create_credit_memo, apply_credit_memo, apply_payment_to_invoice, create_write_off, get_customer_statement, get_customer_ar_summary.
Permissions
- Read:
get_ar_aging, get_customer_ar_aging, get_customer_statement, get_customer_ar_summary — no --apply needed.
- Write:
log_collection_activity, create_credit_memo, apply_credit_memo, apply_payment_to_invoice, create_write_off — requires --apply.
Examples
stateset --db ./store.db "get ar aging"
stateset --db ./store.db "get customer statement customer_id=cust_123"
stateset --db ./store.db "create credit memo customer_id=cust_123 amount=150 reason=PricingError" --apply
stateset --db ./store.db "log collection activity customer_id=cust_123 type=Reminder2" --apply
Status Flows
Invoice Collection: None -> Reminder1Sent -> Reminder2Sent -> Reminder3Sent -> InCollections -> SentToAgency (or WrittenOff/PaymentPlan)
Credit Memo: Draft -> Pending -> Approved -> Applied (or Voided)
Write-Off: Pending -> Approved -> Posted (or Rejected)
Aging Buckets
- Current, 1-30 days, 31-60 days, 61-90 days, 90+ days
Credit Memo Reasons
- ReturnedGoods, PricingError, Overpayment, Damaged, ServiceCredit, GoodwillAdjustment, Other
Output
{"status":"dunning_sent","customer_id":"cust_123","dunning_type":"Reminder2","total_overdue":3250.00,"invoices_overdue":3}
Present Results to User
- Customer name and total outstanding balance.
- Aging breakdown by bucket.
- Collection activity history and next recommended action.
- Credit memo and write-off totals.
Troubleshooting
- Credit memo won't apply: verify memo status is Open and invoice has remaining balance.
- Write-off rejected: ensure approver and GL account are provided.
- Aging mismatch: confirm invoice dates and payment applications are current.
- Dunning not sent: verify customer has a valid email and collection status is advancing.
Error Codes
AR_CREDIT_MEMO_INVALID: Credit memo status must be Open and invoice must have a remaining balance.
AR_WRITEOFF_REJECTED: Write-off requires an approver and a valid GL account.
AR_DUNNING_NO_EMAIL: Customer has no valid email address for dunning delivery.
Related Skills
- commerce-credit: Credit holds triggered by overdue AR balances.
- commerce-general-ledger: AR transactions auto-post journal entries to GL.
- commerce-accounts-payable: Offset vendor credits against customer receivables.
References
- references/ar-collections.md
- /home/dom/stateset-icommerce/crates/stateset-core/src/models/accounts_receivable.rs
- /home/dom/stateset-icommerce/crates/stateset-embedded/src/accounts_receivable.rs
1---2name: commerce-accounts-receivable3description: Manage customer receivables, collections, credit memos, and AR aging. Use when tracking overdue invoices, sending dunning letters, creating write-offs, or generating customer statements.4---56# Commerce Accounts Receivable78Track customer receivables, manage collections, issue credit memos, and monitor AR aging.910## How It Works11121. Monitor AR aging to identify overdue accounts.132. Log collection activities (dunning letters, calls, emails).143. Issue credit memos for returns, pricing errors, or goodwill.154. Apply payments and credit memos to outstanding invoices.165. Write off uncollectible balances with approval.176. Generate customer statements.1819## Usage2021- CLI: `stateset ar ...` or `stateset "AR aging report"`22- Writes require `--apply`.23- MCP tools: `get_ar_aging`, `get_customer_ar_aging`, `log_collection_activity`, `create_credit_memo`, `apply_credit_memo`, `apply_payment_to_invoice`, `create_write_off`, `get_customer_statement`, `get_customer_ar_summary`.2425## Permissions2627- Read: `get_ar_aging`, `get_customer_ar_aging`, `get_customer_statement`, `get_customer_ar_summary` — no `--apply` needed.28- Write: `log_collection_activity`, `create_credit_memo`, `apply_credit_memo`, `apply_payment_to_invoice`, `create_write_off` — requires `--apply`.2930## Examples3132```bash33stateset --db ./store.db "get ar aging"34stateset --db ./store.db "get customer statement customer_id=cust_123"35stateset --db ./store.db "create credit memo customer_id=cust_123 amount=150 reason=PricingError" --apply36stateset --db ./store.db "log collection activity customer_id=cust_123 type=Reminder2" --apply37```3839## Status Flows4041**Invoice Collection:** None -> Reminder1Sent -> Reminder2Sent -> Reminder3Sent -> InCollections -> SentToAgency (or WrittenOff/PaymentPlan)42**Credit Memo:** Draft -> Pending -> Approved -> Applied (or Voided)43**Write-Off:** Pending -> Approved -> Posted (or Rejected)4445## Aging Buckets4647- Current, 1-30 days, 31-60 days, 61-90 days, 90+ days4849## Credit Memo Reasons5051- ReturnedGoods, PricingError, Overpayment, Damaged, ServiceCredit, GoodwillAdjustment, Other5253## Output5455```json56{"status":"dunning_sent","customer_id":"cust_123","dunning_type":"Reminder2","total_overdue":3250.00,"invoices_overdue":3}57```5859## Present Results to User6061- Customer name and total outstanding balance.62- Aging breakdown by bucket.63- Collection activity history and next recommended action.64- Credit memo and write-off totals.6566## Troubleshooting6768- Credit memo won't apply: verify memo status is Open and invoice has remaining balance.69- Write-off rejected: ensure approver and GL account are provided.70- Aging mismatch: confirm invoice dates and payment applications are current.71- Dunning not sent: verify customer has a valid email and collection status is advancing.7273## Error Codes7475- `AR_CREDIT_MEMO_INVALID`: Credit memo status must be Open and invoice must have a remaining balance.76- `AR_WRITEOFF_REJECTED`: Write-off requires an approver and a valid GL account.77- `AR_DUNNING_NO_EMAIL`: Customer has no valid email address for dunning delivery.7879## Related Skills8081- **commerce-credit**: Credit holds triggered by overdue AR balances.82- **commerce-general-ledger**: AR transactions auto-post journal entries to GL.83- **commerce-accounts-payable**: Offset vendor credits against customer receivables.8485## References86- references/ar-collections.md87- /home/dom/stateset-icommerce/crates/stateset-core/src/models/accounts_receivable.rs88- /home/dom/stateset-icommerce/crates/stateset-embedded/src/accounts_receivable.rs