ClaudeLoops
/
Outbound invoice sanity check
All loops
FinanceMedium 11 min· claude-sonnet-4-5

Outbound invoice sanity check

Catch wrong tax rates and bad line items before the invoice sends.

NOT DEPLOYEDNOT DEPLOYED
0148ms
Trigger
POST https://hooks.claudeloops.run/stripe-invoice-anomaly · event=stripe.customer.subscription.created
02808ms
Agent
claude-sonnet-4-5 · in 908 tok · out 231 tok
03198ms
Tools
stripe-mcp/anthropic:messages.create → 200 OK · 228ms
0438ms
Verify
schema check · zod v3 passed
0568ms
Output
slack #finance · anomaly flagged
0628ms
Notify
audit log written · runbook link attached
SUCCESS
0%
0 runs
P50
0ms
median
P95
0ms
tail
AVG COST
per run
LAST OK
never
LAST FAIL
never
none
Latency · last 30 runs0 samples
no runs yet
Latest output · what your users see
Invoice · AnthropicInfra
$3,528.78 USD
// press Test to run once · Watch live to keep streaming · Deploy to make it real
The problem

A misconfigured tax rate or wrong proration once a quarter costs you a refund and a customer trust hit.

The outcome

Bad invoices never send. They go to a `#billing-review` Slack channel with the suspect lines highlighted.

Ingredients & skills

Secrets
  • ANTHROPIC_API_KEY
  • STRIPE_KEY
  • STRIPE_WEBHOOK_SECRET
  • SLACK_WEBHOOK_URL
Providers
  • Anthropic
  • Stripe
  • Slack
MCP servers
  • stripe-mcp
#finance#stripe#billing

How it works

Stripe webhook on `invoice.finalized` but before `invoice.sent`. Claude validates against your billing rules, blocks send if anything looks wrong.

Step 1

1 — Rules file

Plain English. Claude validates each invoice against it.

billing-rules.md
- US customers: tax rate must be Stripe Tax automatic, never manual.
- EU customers: VAT id required on invoice metadata.
- Annual plan proration is forbidden — must use credit notes.
- Any line item with `amount > $50,000` requires a metadata key `approved_by`.
Step 2

2 — Validate

If `block: true`, void and recreate as draft.

One-line deploy

The button above runs the same command with your saved config. This is the raw CLI form.

bash
locker deploy invoice-guard --trigger stripe-webhook
https://hooks.claudeloops.run/stripe-invoice-anomaly

Related loops