Weiter zum Inhalt
Konto erstellen
oder
anmelden
Das Logo der Stripe-Dokumentation
/
KI fragen
Konto erstellen
Anmelden
Jetzt starten
Zahlungen
Finanzautomatisierung
Plattformen und Marktplätze
Geldmanagement
Entwickler-Tools
Jetzt starten
Zahlungen
Finanzautomatisierung
Jetzt starten
Zahlungen
Finanzautomatisierung
Plattformen und Marktplätze
Geldmanagement
Übersicht
Versionierung
Änderungsprotokoll
Aktualisieren Sie Ihre API-Version
Ihre SDK-Version aktualisieren
Entwickler-Tools
SDKs
API
Tests
Workbench
Ereignisziele
Arbeitsabläufe
Stripe-CLI
Stripe Shell
Entwickler-Dashboard
Agent-Toolkit
    Übersicht
    Quickstart
Stripe-StatuswarnungenAufbau mit LLMsStripe für Visual Studio CodeHochgeladene Dateien
Sicherheit
Sicherheit
Extend Stripe
Stripe-Apps
Stripe Connectors
Partner
Partner-Ecosystem
Partner-Zertifizierung
StartseiteEntwickler-ToolsAgent toolkit

Notiz

Bis jetzt ist diese Seite noch nicht in dieser Sprache verfügbar. Wir arbeiten aber verstärkt daran, unsere Dokumentation in weiteren Sprachen bereitzustellen, und werden die Übersetzung sofort anzeigen, sobald diese verfügbar ist.

Add Stripe to your agentic workflowsEntwickler/in 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())

Entwicklervorschau

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.

Vollständiges Beispiel anzeigen
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
War diese Seite hilfreich?
JaNein
Benötigen Sie Hilfe? Kontaktieren Sie den Kundensupport.
Nehmen Sie an unserem Programm für frühzeitigen Zugriff teil.
Schauen Sie sich unser Änderungsprotokoll an.
Fragen? Sales-Team kontaktieren.
LLM? Lesen Sie llms.txt.
Unterstützt von Markdoc