Skip to main content

The problem

An AI agent that calls Stripe directly can issue a refund the moment it decides to — no review, no record, no recourse. One hallucination or misread order ID and the money is gone.

The SafeFetch solution

Wrap the Stripe call in safeFetch() with approve: true. The refund is held as awaiting_approval until a human clicks approve. Nothing hits Stripe until that happens.

Full example

The action is created immediately and returns with status: "awaiting_approval". Stripe is not contacted yet.

What happens next

1

Reviewer receives email

If you passed notify.email, SafeFetch sends an email with one-click Approve and Reject buttons. No login required — the links are signed magic links.
2

Reviewer approves

Clicking Approve moves the action to pending and dispatches the request to Stripe. The receipt page shows the full action details, including the Stripe response.
3

Your callback fires

If you passed a callback URL, SafeFetch sends a POST to it when the action reaches a terminal status (completed or failed). Check action.status and action.response_code to confirm the refund went through.

Checking status programmatically

Poll or check status at any point using the action ID:

Approving via API

If you have your own approval UI instead of the magic-link email, approve programmatically:
Or cancel (reject) it:

Handling the callback

SafeFetch POSTs to your callback URL when the action finishes. Verify the signature and act on the result:

Receipt page

Every action has a receipt page in the dashboard showing the full audit trail: who approved it, when, what Stripe returned, and how long delivery took. Share the URL with your finance team as documentation.
approve: true cannot be combined with sync: true. Synchronous mode waits for immediate completion — that’s incompatible with an asynchronous human decision.