---
name: billing-invoicing-automation
description: Automate end-to-end billing and invoicing from trigger detection through delivery and payment tracking. Use when setting up recurring billing, usage-based billing, milestone billing, dunning processes, invoice delivery channels, payment link generation, or automating the entire billing lifecycle. Triggers on phrases like "automate billing", "setup invoicing", "recurring billing", "generate invoice", "send bill", "dunning", "billing automation", "invoice delivery", "payment link".
---

# Billing & Invoicing Automation

Automate the complete billing lifecycle — from detecting when to bill through ensuring payment is received.

## Workflow

1. **Identify billing model**: Determine whether the billing is recurring (subscription), usage-based (pay-per-use), milestone-based (project), or one-time (transactional).
2. **Configure billing triggers**: Set up rules that fire invoices at the right moment (e.g., monthly anniversary, usage threshold crossed, project milestone completed, PO fulfillment).
3. **Pull billing data**: Aggregate chargeable quantities, rates, discounts, and taxes from source systems (CRM, billing engine, usage meters, project trackers).
4. **Generate invoice**: Create a line-item-level invoice with proper formatting, branding, legal terms, tax calculations, and payment instructions.
5. **Quality gate**: Run validation checks — amounts reconcile to source, tax rates are current, customer details are correct, PO numbers referenced when required.
6. **Deliver**: Send via configured channel (email with PDF attachment, customer portal, EDI, API webhook) and log delivery confirmation.
7. **Payment link generation**: Embed a one-click payment link supporting card, ACH, or wire transfer directly on the invoice.
8. **Status tracking**: Monitor invoice lifecycle — sent → viewed → paid → overdue — with automated actions at each stage.
9. **Dunning sequence**: Trigger escalating reminders for overdue invoices (see dunning workflow below).
10. **Revenue recognition tie-in**: Feed billing data into revenue recognition engine for ASC 606 / IFRS 15 compliance.

## Billing Model Matrix

| Model | Trigger | Best For | Complexity | Tools |
|-------|---------|----------|------------|-------|
| **Subscription/Recurring** | Fixed schedule (monthly, quarterly, annually) | SaaS, membership, retainer services | Low | Stripe Billing, Chargebee, Zuora |
| **Usage-Based** | Metered consumption (API calls, storage, seats) | Cloud services, utilities, telecom | Medium | AWS Billing, Twilio Flex Billing, custom meters |
| **Milestone** | Project deliverable completion | Consulting, agencies, construction | Medium | PSA tools (Harvest, Rippling PSA) |
| **One-Time** | Order fulfillment, transaction event | E-commerce, professional services | Low | Shopify, QuickBooks, Xero |
| **Hybrid** | Combination of recurring + usage + one-time | Complex SaaS, B2B platforms | High | Zuora, Chargebee, custom |
| **Blanket PO** | Delivery against blanket PO line | Enterprise B2B, manufacturing | High | SAP Ariba, Oracle Procurement Cloud |

## Invoice Generation Template

Structure every invoice with these mandatory elements:

```
INVOICE #[Number]
Date: [Invoice Date]
Due Date: [Net Terms — Net 15/30/45/60]

Bill To:
  [Customer Legal Name]
  [Billing Address]
  [Tax ID / VAT Number]
  [Contact Email]

PO Number: [If applicable]
Contract Reference: [If applicable]

LINE ITEMS:
  ─────────────────────────────────────────────
  Description          Qty     Rate      Amount
  ─────────────────────────────────────────────
  [Service/Product 1]  [Qty]   [Rate]    [Amount]
  [Service/Product 2]  [Qty]   [Rate]    [Amount]
  ─────────────────────────────────────────────
  Subtotal:                          [$]
  Discount (if any):                [-$]
  Tax (rate % by jurisdiction):     [$]
  Shipping/Fees (if any):           [$]
  ─────────────────────────────────────────────
  TOTAL DUE:                       [$]

PAYMENT METHODS:
  • One-click pay: [Payment Link]
  • ACH: [Routing] [Account]
  • Wire: [Bank details]
  • Check: [Mailing address]

TERMS & CONDITIONS:
  [Late fee clause] [Dispute deadline] [Governing law]
```

## Dunning (Collections Reminder) Workflow

Configure escalating reminders based on days past due:

| Stage | Days Past Due | Channel | Tone | Content |
|-------|---------------|---------|------|---------|
| **Pre-due** | -3 days | Email | Helpful | "Friendly reminder: Invoice #[N] due on [date]. Pay now: [link]" |
| **Due day** | 0 days | Email | Professional | "Invoice #[N] is due today. Pay now: [link]" |
| **Reminder 1** | 7 days | Email + SMS | Polite | "Invoice #[N] is 7 days overdue ($[amount]). Please remit: [link]" |
| **Reminder 2** | 14 days | Email + Phone task | Firm | "Your account has an outstanding balance. Please contact us to resolve." |
| **Escalation** | 30 days | Certified mail + Account flag | Formal | "Final notice: account will be restricted. Contact billing@company.com immediately." |
| **Write-off referral** | 60+ days | Handoff to collections agency | — | Transfer account with complete payment history |

**Dunning Rules:**
- Pause dunning immediately upon payment receipt
- For enterprise customers (> $50K ARR), route reminders through account manager instead of automated emails
- Log every dunning interaction in the customer's account record
- Flag disputed invoices — pause dunning, route to dispute resolution
- Track dunning conversion rates to optimize timing and messaging

## Multi-Currency & Tax Handling

### Currency

- Bill in customer's preferred currency when possible
- Use real-time FX rates (lock rate at invoice generation, not payment)
- Disclose FX rate used on the invoice for transparency
- For recurring billing, decide: lock rate at contract signing OR reprice monthly at current rate

### Tax Calculation

- Maintain current tax rate matrix by jurisdiction (state, county, city, country)
- Check nexus rules — do you have tax obligation in this jurisdiction?
- Apply tax-exempt certificates automatically (verify certificate validity annually)
- For international B2B: VAT reverse charge (EU), GST (India/Canada/Australia), withholding tax (varies)
- Integrate with tax engines: Avalara, TaxJar, Vertex for real-time calculation

## Reconciliation & Validation

Before any invoice leaves the system, run these checks:

1. **Amount reconciliation**: Invoice total = Σ(line items) ± discount ± tax ± fees
2. **Rate verification**: Unit prices match the active contract or price list
3. **Quantity validation**: Usage quantities pulled from meter match expected ranges (flag anomalies > 2σ)
4. **Customer status check**: Is the customer still active? (prevents billing terminated accounts)
5. **Duplicate prevention**: Check for existing invoices with same period + same line items
6. **Credit balance check**: Apply existing credit memos before creating new invoice
7. **PO number presence**: If customer requires PO, confirm it's populated

## Edge Cases

- **Prorated charges**: When a mid-cycle change occurs (upgrade/downgrade/cancellation), prorate the remaining period proportionally
- **Credit memos**: Generate credit for billing errors, service credits, or overpayments — apply credits to next invoice automatically
- **Invoice corrections**: Void and re-issue (never edit sent invoices); document reason for correction
- **Multi-entity billing**: When billing across legal entities, ensure intercompany billing is at arm's length pricing
- **Contract amendments**: When a contract mid-term amendment changes pricing or scope, back-bill or credit prior periods as appropriate
- **Chargebacks**: For card payments, monitor for chargebacks; prepare evidence package (signed contract, delivery proof, usage logs)
- **Negative invoicing**: When refunds exceed outstanding balance, issue a refund or credit — never a negative invoice

## Output

### Billing Dashboard

```
BILLING DASHBOARD — Month of January 2025
==========================================
Invoices Generated: 1,247
Total Invoiced:      $2.8M
Paid (YTD):          $2.5M (89%)
Overdue (>30 days):  $142K (5.1%)
Disputed:            $28K (1.0%)

TOP OVERDUE ACCOUNTS:
  1. Acme Corp        — $45,200  — 42 days overdue
  2. GlobalTech Inc.  — $32,800  — 38 days overdue
  3. StartupXYZ       — $18,500  — 35 days overdue

BILLING BY MODEL:
  Subscription:       $1.9M (68%)
  Usage-based:        $620K (22%)
  One-time:           $180K (6%)
  Milestone:          $100K (4%)
```

## Integration Points

- CRM (Salesforce, HubSpot): Customer data, contract terms, PO references
- Billing engines (Stripe Billing, Chargebee, Zuora): Recurring billing, metered usage, payment processing
- ERP/Accounting (NetSuite, QuickBooks, SAP): Invoice posting, GL coding, revenue recognition
- Tax engines (Avalara, TaxJar, Vertex): Real-time tax calculation
- E-signature (DocuSign): Contract signing tied to billing start dates
- Email (SendGrid, Mailgun): Invoice delivery and dunning emails
- Payment processors (Stripe, Adyen, PayPal): Payment links, one-click payment
- Customer portals (Custily, Chargebee portal): Self-service invoice access
- Data warehouse: Historical billing analytics and trend reporting
