Integrations

PayPal's agent toolkit supports OpenAI’s Agents SDKarrow-up-right , Vercel’s AI SDKarrow-up-right, and Model Context Protocol (MCP)arrow-up-right . It works with LLM providers that support function calling and is compatible with TypeScript and Python.

Set up your environment

To prepare for an integration, set up your environment first.

  • Download and install Node.js version 18 or later from the official Node.jsarrow-up-right website.

  • Run the command npm install @paypal/agent-toolkit to install the agent toolkit, or download the package from the GitHub repoarrow-up-right .

You'll also need your PayPal account's client ID and secret from PayPal Developer Dashboardarrow-up-right to configure this library.

Set up an integration

See the corresponding topic for your AI platform in this guide.

For information about setting up the front end for testing any of these integrations, see the agent toolkit quickstart guidearrow-up-right .

Complete the following steps to integrate PayPal's agent toolkit with OpenAI's Agents SDK. The agent toolkit works with Agents SDK, whichpasses it as a list of tools.

2

Update your clientId and clientSecret with the values from PayPal Developer Dashboardarrow-up-right.

from paypal_agent_toolkit.openai.toolkit import PayPalToolkit
from paypal_agent_toolkit.common.configuration import Configuration, Context

configuration = Configuration(
    actions={
        "orders": {
            "create": True,
            "get": True,
            "capture": True,
        }
    },
    context=Context(
        sandbox=True
    )
)

# Initialize toolkit
toolkit = PayPalToolkit(client_id=PAYPAL_CLIENT_ID, secret=PAYPAL_SECRET, configuration = configuration)
3

You can use the agent toolkit's functions and other tools as your integration requires.

from agents import Agent

tools = toolkit.get_tools()

agent = Agent(
    name="PayPal Assistant",
    instructions="""
    You're a helpful assistant specialized in managing PayPal transactions:
    - To create orders, invoke create_order.
    - After approval by user, invoke capture_order.
    - To check an order status, invoke get_order_status.
    """,
    tools=tools
)
4

Test your integration.

Was this helpful?