Stripe integration

Stripe AI agents: refund status, invoices and billing questions

Billing questions are mostly lookups: the status of a refund, the last invoice, the next renewal date. Stripe's API answers them over HTTPS with a restricted key, and the signed-in user's customer id from the identity token keeps every lookup scoped to the right person.

Tool type
HTTP API
Auth type
bearer_token (restricted key)
Safety level
safe_read for lookups, destructive for refunds

What you can build

A support agent on your app that answers 'where is my refund?' from the live refund object.

A billing assistant that lists recent invoices and explains a line item.

An agent that prepares a refund request for a human to approve, never issuing it on its own.

How to connect Stripe

  1. 01Create a restricted Stripe key with read access to customers, invoices and refunds. Store it on the tool's auth settings as a bearer token.
  2. 02Declare the customer id as a custom claim in the app's auth context so it enters the prompt for signed-in users, and require verified identity for the app.
  3. 03Create read-only HTTP API tools, for example GET /v1/invoices?customer={{customer_id}} and GET /v1/refunds?customer={{customer_id}}, with safe_read.
  4. 04If a refund tool exists at all, give it the destructive safety level and requires approval, and keep its description explicit about confirmation.
  5. 05Attach the tools, sign in as a test user in the widget demo, and check the customer id in the rendered request.

Example tool definition

The shape a tool takes in the AgentRow builder API. Credentials are stored on the tool's auth settings, not in its configuration, so they never reach a prompt. Placeholders in double braces are filled by the model from the input schema.

{
  "name": "stripe_list_refunds",
  "type": "http_api",
  "description": "List recent refunds for the signed-in customer. Use when the user asks about a refund's status.",
  "auth_type": "bearer_token",
  "safety_level": "safe_read",
  "is_readonly": true,
  "config": {
    "method": "GET",
    "url": "https://api.stripe.com/v1/refunds",
    "query_params": { "customer": "{{customer_id}}", "limit": "5" },
    "allowed_domains": ["api.stripe.com"]
  },
  "input_schema": {
    "type": "object",
    "properties": {
      "customer_id": { "type": "string", "description": "The Stripe customer id from the user's identity claims" }
    },
    "required": ["customer_id"]
  }
}

What the run trace shows

Every call appears in the run trace with the rendered request, the response status and body, timing, retries and errors, plus what the model was shown of the result. If the model never called the tool, the toolbox step shows whether it was bound for that model call and why.

Frequently asked questions

How does the agent know which customer is asking?

From the identity token your backend signs: declare the customer id as a custom claim in the app's auth context and it is available to the agent for signed-in users only.

Should an agent issue refunds?

Treat it as destructive: safety level destructive, requires approval on, and a toolbox permission scope that excludes destructive tools where they are not needed. Most teams let the agent prepare the request and a person confirm it.

Can anonymous visitors use these tools?

Only tools that do not need a customer id. Set the app to require verified identity when the assistant must know who it is talking to.

Connect Stripe to your first agent

Join the waitlist for early access. Tell us which systems you need to connect and we will point you at the right tool definitions.