AI agent for Stripe payment operations with human-in-the-loop approval for refunds.
- Subscription status — check plan, billing cycle, and next payment
- Refund processing — eligibility check + mandatory human approval gate
- Invoice summaries — line items, taxes, discounts, payment status
- Anomaly detection — flags high-amount charges, velocity abuse, disputes
frontend (React + Vite) → backend (FastAPI) → Claude claude-opus-4-6
↓ tool calls
Stripe API
↓
PostgreSQL (conversation state)
Human-in-the-loop: process_refund is an approval-gated tool. The agent
pauses the agentic loop and emits an approval_required event. The UI shows
Approve/Cancel buttons. Only on approval does the refund execute.
cd backend
cp ../.env.example ../.env # fill in your keys
pip install -r requirements.txt
# create the database
createdb finance_agent
uvicorn main:app --reloadcd frontend
npm install
npm run devstripe listen --forward-to localhost:8000/webhook/stripeCheck subscription for cus_abc123Is charge ch_xyz789 eligible for a refund?Process a full refund for ch_xyz789→ agent checks eligibility → asks approvalSummarize invoice in_def456Flag any anomalies for customer cus_abc123 in the last 60 days