Accéder directement au contenu
Créez un compte
ou
connecter-vous
Logo de la documentation Stripe
/
Demander à l'assistant IA
Créez un compte
Connectez-vous
Démarrer
Paiements
Automatisation des opérations financières
Plateformes et places de marché
Gestion de fonds
Outils de développement
Démarrer
Paiements
Automatisation des opérations financières
Démarrer
Paiements
Automatisation des opérations financières
Plateformes et places de marché
Gestion de fonds
Aperçu
Gestion des versions
Journal des modifications
Mettre à niveau votre version de l'API
Actualiser votre version du SDK
Outils de développement
SDK
API
Tests
Workbench
Destinations d'événements
Workflows
CLI Stripe
Shell Stripe
Dashboard des développeurs
Boîte à outils des agents
    Présentation
    Démarrage rapide
Alertes d'intégrité de StripeDéveloppez avec des grands modèles de langage (LLM)Stripe pour Visual Studio CodeChargements de fichiers
Sécurité
Sécurité
Extensions Stripe
Stripe Apps
Connecteurs Stripe
Partenaires
Partner ecosystem
Certification des partenaires
AccueilOutils de développementAgent toolkit

Remarque

Cette page n'est pas encore disponible dans cette langue. Nous faisons tout notre possible pour proposer notre documentation dans davantage de langues et nous vous fournirons la version traduite dès qu'elle sera disponible.

Add Stripe to your agentic workflowsVersion bêta à destination des développeurs

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())

Version bêta à destination des développeurs

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.

Afficher l'exemple dans son intégralité
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
Cette page vous a-t-elle été utile ?
OuiNon
Besoin d'aide ? Contactez le service Support.
Rejoignez notre programme d'accès anticipé.
Consultez notre log des modifications.
Des questions ? Contactez l'équipe commerciale.
LLM ? Lire llms.txt.
Propulsé par Markdoc