Integrations · Agent framework
How to let CrewAI issue Stripe refunds with manager approval
CrewAI crews that refund with a named approver. A @tool posts to Countersign.
Auto-approve under $50
Small refunds that fit your rules go through at once.
Route the rest
A named approver gets a one-tap card on their phone.
Log everything
Who approved, why, the Stripe refund id. CSV for finance.
Setup: CrewAI tool
- Sign up free, connect Stripe with a restricted key (test mode works) and pick a policy.
- Set COUNTERSIGN_KEY in your environment.
- Give the tool to your agent instead of any Stripe refund tool. The agent never sees a Stripe key.
import os, requests
from crewai.tools import tool
@tool("request_refund")
def request_refund(charge_id: str, amount_cents: int, reason: str, reasoning: str, ticket_url: str = "") -> dict:
"""Ask for a Stripe refund. Small ones that fit policy go through at once; others wait for a person.
Relay the returned 'message' to the customer and never promise a refund that is pending or denied."""
r = requests.post(
"https://countersign.vibiz.app/api/v1/refunds/request",
headers={"Authorization": f"Bearer {os.environ['COUNTERSIGN_KEY']}"},
json={"charge_id": charge_id, "amount": amount_cents, "reason": reason,
"agent_reasoning": reasoning, "ticket_url": ticket_url or None, "agent_name": "crewai"},
timeout=30,
)
return r.json()Replace cs_YOUR_KEY; in the dashboard this snippet comes with your key filled in.
Questions
Does CrewAI get access to my Stripe account?
No. CrewAI gets a Countersign key that can only ask for refunds. Countersign holds a restricted Stripe key and refunds only after your policy or an approver says yes.
What does the agent get back?
status (approved_and_refunded, pending or denied), a message to relay to the customer, the rule that decided it, and a status_url for pending requests.
Who approves the big ones?
The approver for that amount tier gets an email with a one-tap approve card: customer, charge, refundable balance, earlier refunds, the agent's reasoning and the ticket link.