← All integrations

Stripe AI agent integration

Anlyon's Stripe integration gives an AI agent named Stripe actions to call through Anlyon's API: it can look up customers, payments, invoices and subscriptions, and issue refunds. Each of your users connects their own Stripe account with a key they create in Stripe, and your company's account connects the same way. Your agent calls each action by name and never holds the key.

Let an agent look up customers, payments, invoices and subscriptions, and issue refunds without the power to empty the account. Every refund counts in money against one ceiling shared by every agent and key, a large one waits for a person, and the result is read back from Stripe.

This page covers Anlyon's own Stripe integration, while Stripe's official MCP server and how to add it to a client are on the Stripe MCP server page.

Stripesecret · STRIPE
host
api.stripe.com
connect
API key, per user
  • Refund payment

    stripe-refund-payment

  • Create customer

    stripe-create-customer

  • Update customer

    stripe-update-customer

  • Delete customer

    stripe-delete-customer

writes are off until switched on

What can an AI agent do in Stripe? Writes are off until you switch them on.

Each one is a named operation from the pack. Reads change nothing.

Writes

  • Refund payment

    read back

    stripe-refund-payment

    Refund part or all of one payment intent, in minor units of the pack's currency, from the account and in the mode fixed at install. Stripe's idempotency key and a read-back of the refund grade the receipt; a refund can stay pending and finish later. Refunds cannot be reversed.

  • Create customer

    read back

    stripe-create-customer

    Create one customer with this email, and optionally a name, description, phone and metadata.

  • Update customer

    read back

    stripe-update-customer

    Change one customer's email, name, description or phone, or merge keys into its metadata; fields left out are not changed.

  • Delete customer

    read back

    stripe-delete-customer

    Permanently delete one customer. Stripe also cancels the customer's active subscriptions at once and removes its saved cards; this cannot be undone.

  • Cancel subscription

    read back

    stripe-cancel-subscription

    Cancel one subscription now. The customer is not charged for it again; invoice_now bills un-invoiced usage and pending prorations at once, and prorate credits the unused time. This cannot be undone.

  • Set subscription cancel at period end

    read back

    stripe-set-subscription-cancel-at-period-end

    Set whether one subscription cancels at the end of its current period (true) or keeps renewing (false); nothing is canceled now.

  • Finalize invoice

    read back

    stripe-finalize-invoice

    Finalize one draft invoice so it gets a number and can be paid, with automatic collection turned off: Stripe does not charge or email the customer because of this call.

  • Void invoice

    read back

    stripe-void-invoice

    Void one finalized invoice that is not paid, so it can no longer be paid; it stays on record. This cannot be undone.

Reads

  • List customers

    stripe-list-customers

    List customers, optionally only those whose email is exactly this one (Stripe compares case-sensitively). 20 per page, newest first; when has_more is true, pass the last customer's id as starting_after (cus_...) for the next page.

  • Get customer

    stripe-get-customer

    Get one customer by id: email, name, description, phone, balance, metadata and invoice settings. A deleted customer returns only its id and deleted: true.

  • Search customers

    stripe-search-customers

    Search customers with Stripe's search query language, for example email:'jane@example.com', name~'Jane' or metadata['crm_id']:'42'. 20 per page; when has_more is true, pass next_page as page.

  • List payment intents

    stripe-list-payment-intents

    List payment intents, optionally for one customer. Returns amount, amount_received, currency, status and latest_charge for each. 10 per page, newest first; when has_more is true, pass the last payment intent's id as starting_after (pi_...) for the next page.

  • Get payment intent

    stripe-get-payment-intent

    Get one payment intent by id: amount, amount_received, currency, status, customer, latest_charge and last_payment_error. Use it before refund-payment to see what was paid.

  • List charges

    stripe-list-charges

    List charges, optionally for one customer or one payment intent. Returns amount, amount_refunded, refunded, disputed, outcome and card brand and last4 for each. 10 per page, newest first; when has_more is true, pass the last charge's id as starting_after (ch_... or py_...) for the next page.

  • Get charge

    stripe-get-charge

    Get one charge by id: amount, amount_refunded, refunded, disputed, failure_code, outcome, receipt_url and payment method details.

  • List refunds

    stripe-list-refunds

    List refunds, optionally for one charge or one payment intent. Returns amount, currency, status and reason for each. 20 per page, newest first; when has_more is true, pass the last refund's id as starting_after (re_... or pyr_...) for the next page.

  • Get refund

    stripe-get-refund

    Get one refund by id: amount, currency, status (pending, requires_action, succeeded, failed or canceled), reason and the charge and payment intent it belongs to.

  • List invoices

    stripe-list-invoices

    List invoices, optionally for one customer or subscription, or in one status. Each invoice carries its first line items, so pages are small. 5 per page, newest first; when has_more is true, pass the last invoice's id as starting_after (in_...) for the next page.

  • Get invoice

    stripe-get-invoice

    Get one invoice by id: status, amounts due, paid and remaining, due date, hosted invoice URL and its line items. An invoice with many lines can be cut at the response limit.

  • List subscriptions

    stripe-list-subscriptions

    List subscriptions, optionally for one customer or one price, or in one status. Without status Stripe returns every subscription that is not canceled; pass all for every status. 10 per page, newest first; when has_more is true, pass the last subscription's id as starting_after (sub_...) for the next page.

  • Get subscription

    stripe-get-subscription

    Get one subscription by id: status, cancel_at_period_end, cancel_at, canceled_at, its items with price and current period, and latest_invoice.

  • Get balance

    stripe-get-balance

    Get the account's balance: the amounts available and pending, per currency, in minor units.

  • List balance transactions

    stripe-list-balance-transactions

    List the transactions that make up the balance (charges, refunds, fees, payouts and so on), optionally of one type, from one payout, or for one source object. Returns amount, fee, net, status and available_on for each. 25 per page, newest first; when has_more is true, pass the last transaction's id as starting_after (txn_...) for the next page.

How do users connect? Each one brings their own Stripe.

  1. 1.Call for the userYour server invokes the action for the signed-in user. Without a Stripe connection, the SDK throws EndUserNotConnectedError with a connect link.
  2. 2.The user pastes a keyThe link opens a form that shows where in Stripe's settings to create the key. The link lasts 10 minutes and works once.
  3. 3.Anlyon checks itThe key is checked with Stripe before it is kept, and bound to api.stripe.com. It is never shown back.
  4. 4.Your server confirmsYour server confirms the connection for the user who is signed in, and the call goes through.

How do I control what an AI agent does in Stripe? Suggested limits and approvals, for you to review.

Suggested limits

  • Refunds: 500.00 USD a day
  • 100 customers created a day
  • 200 customers updated a day
  • 10 customers deleted a day
  • 10 subscriptions canceled a day
  • 20 subscription renewals changed a day
  • 50 invoices finalized a day
  • 10 invoices voided a day

Suggested approvals

  • A person approves refunds over 100.00
  • A person approves deleting a customer
  • A person approves canceling a subscription
  • A person approves scheduling a subscription to end
  • A person approves voiding an invoice

What the key must allow

  • A restricted key you create
  • Customers, Refunds, Invoices and Subscriptions: Write
  • Payment Intents, Charges and Balance: Read

Good to know

  • A repeated request refunds nothing twice: Stripe's own idempotency covers it.
  • The key's mode must match the mode you name. A live key is refused for a test-mode action.

For your own account

  1. 1.In Stripe, open Developers, API keys, and create a restricted key with Refunds: Write.
  2. 2.In Anlyon, open Actions, then Integrations, choose Stripe and paste the key.
  3. 3.Anlyon checks the key with Stripe before storing it. It becomes a secret named STRIPE, bound to api.stripe.com.
  4. 4.Declare one refund action with the Stripe adapter, naming your account, the mode and the currency.

How do I call Stripe from my agent's code? For one of your users, or for your own account.

Act for one of your users from your server, or connect your company's own Stripe with the CLI.

stripe.ts
import { Client, EndUserNotConnectedError } from "@anlyonhq/sdk";const anlyon = new Client({ apiKey: process.env.ANLYON_API_KEY! });try {  const { data } = await anlyon    .forUser(session.userId)    .actions.invoke("stripe-refund-payment", {      paymentIntent: "pi_3P9xExample",      amount: "1200",      currency: "usd",      reason: "requested_by_customer"    });  return { status: "done", grade: data.grade };} catch (error) {  if (error instanceof EndUserNotConnectedError) {    // The user connects their own Stripe, then you call again.    return { status: "connect_required", url: error.connectUrl };  }  throw error;}

Questions. Stripe and AI agents.

Anything still unanswered is worth an email.

support@anlyon.com

Email us

Connect a Stripe account in Anlyon, switch on the operations the agent may use, and call them from the TypeScript or Python SDK or over MCP. Each of your users connects their own account through a connect link, where they paste a key they create in Stripe. Your agent sees the operations by name and never sees the credential.

Through Anlyon it can look up customers, payments, invoices and subscriptions, and issue refunds. Reads change nothing. Writes are off until you switch them on, and every write leaves a receipt.

Yes. Every Stripe action you enable is also an MCP tool on Anlyon's hosted MCP server, at https://api.anlyon.com/mcp. Add that address to Claude Code, Cursor or Codex and sign in. This is Anlyon's integration, not Stripe's own MCP server, which has its own page here: Stripe MCP server.

No. The key stays with Anlyon and is sent only in the request to Stripe's API. No API returns it, to you, to the console or to an agent.

Let your agent act for your users, safely.

A few lines of server code, then send a user a connect link. Nothing to host.

$ claude mcp add --transport http anlyon https://api.anlyon.com/mcp