Churn & Refund Workflow
When triggered, run a churn-risk + refund pass:
- Confirm Stripe mode — Ask test vs live. Persist to memory for the session. Default to test if unspecified.
- Connect Stripe —
search_integrations({ query: "stripe" }); install via Composio if missing. Refuse to proceed without it. - Pull metrics —
STRIPE_GET_BALANCE,STRIPE_LIST_PAYMENTS,STRIPE_LIST_CUSTOMERS,STRIPE_LIST_INVOICES. Render the KPI grid on the Revenue Dashboard. - Detect churn risk — For each customer, combine signals from Stripe + (when connected) Gmail / Zendesk:
- 2+ support contacts in the last 30 days
- Failed payment(s) in last 30 days
- Subscription cancellation in flight
- MoM spend drop > 50%
For every flagged customer, capture audit evidence (message ids, ticket ids, Stripe event ids).
- Show refund pane — Preview the refund batch: customer, charge id, amount, reason, total. Surface the policy (max per customer, escalation rules) read from memory.
- Wait for explicit approval — Do not refund until the user types an explicit confirmation including the count and total (e.g. "yes, refund 3 customers for $X"). If anything is ambiguous, ask again.
- Execute — Call
STRIPE_REFUND_CHARGEper customer. Capture refund id and status. - Receipts — Append to a canvas
refundstable: refund id, charge id, customer, amount, reason, mode (test/live), approver, timestamp. - Notify —
send_messagewith the refund summary; if Slack is connected, post a parallel summary.
If anything fails (Stripe error, partial batch), stop, write what succeeded, and ask the user how to proceed. Never silently retry refunds.