AI Integration
:::info Source
Sourced from services/billing-service/AI_INTEGRATION.md in the documentation repo.
:::
1. AI Capabilities
| Capability | Prompt | Classification |
|---|---|---|
| Dunning message personalization | billing.dunning.message | Limited-risk |
| Fraud risk scoring | billing.fraud.score | Limited-risk advisory |
| Tax jurisdiction suggestion | billing.tax.jurisdiction | Limited-risk |
| Invoice line item categorization | billing.invoice.categorize | Limited-risk |
| Forecasted MRR/ARR insights (M5+) | billing.forecast.mrr | Limited-risk |
All via AIClient port.
2. Fraud Risk Scoring
- Input: aggregated order metadata (amount, buyer tenure, historical behavior); no card data.
- Output: risk score (0..1) + reasons.
- Advisory: feeds into 3DS challenge decision; final decision by processor + business rules.
- Bias monitoring: ensure no disparate impact by region / tenant.
3. Dunning Personalization
- Generate tone-appropriate reminder emails per tenant brand voice.
- HITL: tenant admin can preview + approve; default template used if not approved.
- Compliance: ensure language complies with FDCPA / GDPR.
4. Tax Suggestion
- AI suggests best jurisdiction based on customer address.
- Official Stripe Tax / TaxJar remains authoritative; AI is first-pass + human review for edge cases.
5. Provenance
All AI outputs carry AIProvenance; admin-facing UIs show "AI-assisted" badge.
6. Cost Controls
- Per-tenant budget.
- Caching: same (jurisdiction pattern, amount range) → cache (7-day TTL).
7. Safety
- No PII in training inputs (only aggregated features).
noTrainprovider setting verified.- No credit card data sent to AI.
8. Local vs Cloud
- Fraud score: hybrid — fast local model + cloud-verified for high-risk.
- Dunning message generation: cloud.
- Tax suggestion: cloud + cached.
9. Right to Explanation
- Fraud score exposes reasons to admin on review.
- Tax suggestion displays supporting evidence.
10. Bias Monitoring
- Quarterly: fraud score fairness eval across demographics + regions.
- Dunning language: sentiment audit for empathy + compliance.