Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Developer tools
Get started
Payments
Finance automation
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Overview
Versioning
Changelog
Upgrade your API version
Upgrade your SDK version
Developer tools
SDKs
API
Testing
Workbench
Event Destinations
Workflows
Stripe CLI
Stripe Shell
Developers Dashboard
Agent toolkit
    Overview
    Quickstart
Stripe health alertsBuilding with LLMsStripe for Visual Studio CodeFile uploads
Security
Security
Extend Stripe
Stripe Apps
Stripe Connectors
Partners
Partner ecosystem
Partner certification
HomeDeveloper toolsAgent toolkit

Add Stripe to your agentic workflowsDeveloper preview

Use financial services with agents.

Use Stripe to run your agent business and enhance your agents’ functionality. By enabling access to financial services and tools, you allow your agents to help you earn and spend funds, expanding their capabilities.

Create Stripe objects

Automate common payment workflows with function calling.

Charge for agent usage

Bill users with usage-based billing and charge for calls to MCP servers.

Buy goods online

Use single-use virtual cards to purchase goods.

Create Stripe objects

Use function calling to create and manage Stripe objects. For example, dynamically create Payment Links to accept funds, integrate into your support workflows to help customers, and scaffold test data.

The Stripe agent toolkit supports OpenAI’s Agents SDK, Vercel’s AI SDK, LangChain, and CrewAI. It works with any LLM provider that supports function calling and is compatible with Python and TypeScript.

Python
import asyncio import os from agents import Agent, Runner from stripe_agent_toolkit.openai.toolkit import StripeAgentToolkit stripe_agent_toolkit = StripeAgentToolkit( secret_key=os.getenv("STRIPE_SECRET_KEY"), configuration={ "actions": { "payment_links": { "create": True, }, "products": { "create": True, }, "prices": { "create": True, }, } }, ) agent = Agent( name="Stripe Agent", instructions="Integrate with Stripe effectively to support business needs.", tools=stripe_agent_toolkit.get_tools() ) async def main(): assignment = "Create a payment link for a new product called \"Test\" with a price of $100." result = await Runner.run(agent, assignment) print(result.final_output) if __name__ == "__main__": asyncio.run(main())

Developer preview

Learn how to use this SDK to integrate Stripe into agentic workflows. Because agent behavior is non-deterministic, use the SDK in a sandbox and run evaluations to assess your application’s performance. Additionally, use restricted API keys to limit access to the functionality your agent requires.

Charge for agent usage

Agents SDKs

Integrate usage-based billing to record usage. The Stripe agent toolkit offers native support for billing by prompt and completion token usage in the OpenAI Agents SDK and Vercel AI SDK. You can forward LLM costs directly to your users using a Customer and event_names for input and output Meter Events.

from agents import Agent, Runner from stripe_agent_toolkit.openai.toolkit import StripeAgentToolkit stripe_agent_toolkit = StripeAgentToolkit( secret_key=os.getenv("STRIPE_SECRET_KEY"), configuration={} ) agent = Agent( name="Agent", instructions="Integrate with Stripe effectively to support business needs.", hooks=stripe_agent_toolkit.billing_hook( type="token", customer=os.getenv("STRIPE_CUSTOMER_ID"), meters={ "input": os.getenv("STRIPE_METER_INPUT"), "output": os.getenv("STRIPE_METER_OUTPUT"), }, ), )

Model Context Protocol servers Public preview

Model Context Protocol (MCP) is an open protocol to standardize how applications provide context to LLMs. The Stripe Agent toolkit offers wrapper functions to monetize your tool calls to MCP servers hosted on Cloudflare’s Agent SDK.

View full sample
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; import { McpAgent } from "agents/mcp"; import { generateImage } from "./imageGenerator"; import { OAuthProvider } from "@cloudflare/workers-oauth-provider"; import { PaymentState, experimental_PaidMcpAgent as PaidMcpAgent, } from '@stripe/agent-toolkit/cloudflare'; import app from "./app"; type Bindings = Env; type Props = { // Populate this via OAuth userEmail: string; }; type State = {}; export class MyMCP extends PaidMcpAgent<Bindings, State, Props> { server = new McpServer({ name: "Demo", version: "1.0.0", }); initialState: State = {}; async init() { this.paidTool( "generate_emoji", { object: z.string().describe("one word") }, ({ object }) => { return { content: [{ type: "text", text: generateImage(object) }], }; }, { priceId:
'{{PRICE_ID}}'
, successUrl: '{{SUCCESS_URL}}', paymentReason: 'Emoji generation costs 10 cents per emoji', } ); } } export default new OAuthProvider({ apiRoute: "/sse", apiHandler: MyMCP.mount("/sse"), defaultHandler: app, authorizeEndpoint: "/authorize", tokenEndpoint: "/token", clientRegistrationEndpoint: "/register", });

To search Stripe documentation and query your Stripe data, use the Stripe MCP server.

Buy goods online

  • Issuing: Create single-use virtual cards for your business purchases. This allows your agents to spend funds. The Issuing APIs allow you to programmatically approve or decline authorizations, ensuring your purchase intent matches the authorization. Spending controls allow you to set budgets and limit spending for your agents.
  • Order Intents Private preview: Give your agents commerce capabilities through programmatic execution of purchases online. This agentic API helps facilitate variant and fulfillment selections and manage the order lifecycle. To join the private preview, fill out the form below.

Next steps

  • Agent quickstart
  • Agent toolkit on GitHub
  • B2B payments with Issuing
Was this page helpful?
YesNo
Need help? Contact Support.
Join our early access programme.
Check out our changelog.
Questions? Contact Sales.
LLM? Read llms.txt.
Powered by Markdoc