paypal-agent-toolkit


Namepaypal-agent-toolkit JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummaryA toolkit for agent interactions with PayPal API.
upload_time2025-04-18 23:56:14
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseNone
keywords paypal payments checkout api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PayPal Agentic Toolkit

The PayPal Agentic Toolkit integrates PayPal's REST APIs seamlessly with OpenAI Agents, allowing AI-driven management of PayPal transactions.

## Available tools

The PayPal Agent toolkit provides the following tools:

**Orders**

- `create_order`: Create an order in PayPal system based on provided details
- `get_order`: Retrieve the details of an order
- `capture_order`: Capture payment for an authorized order

**Products**

- `create_product`: Create a new product in the PayPal catalog
- `list_products`: List products with optional pagination and filtering
- `show_product_details`: Retrieve details of a specific product
- `update_product`: Update an existing product

**Subscription Plans**

- `create_subscription_plan`: Create a new subscription plan
- `list_subscription_plans`: List subscription plans
- `show_subscription_plan_details`: Retrieve details of a specific subscription plan

**Subscriptions**

- `create_subscription`: Create a new subscription
- `show_subscription_details`: Retrieve details of a specific subscription
- `cancel_subscription`: Cancel an active subscription


## Prerequisites

Before setting up the workspace, ensure you have the following installed:
- Python 3.11 or higher
- `pip` (Python package manager)
- A PayPal developer account for API credentials

## Installation

You don't need this source code unless you want to modify the package. If you just
want to use the package, just run:

```sh
pip install paypal-agent-toolkit
```

## Usage

The library needs to be configured with your PayPal developer account's API credentials which is
available in your [PayPal Developer Dashboard][app-keys].

```python
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)

```

This toolkit is designed to work with OpenAI's Agent SDK and Assistant API. It provides pre-built tools for managing PayPal transactions like creating, capturing, and checking orders details etc.


### Using with OpenAI Agent SDK
```python
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
)
```


### Using with OpenAI Assistants API
```python

tools = toolkit.get_openai_chat_tools()
paypal_api = toolkit.get_paypal_api()

# Create assistant
assistant = client.beta.assistants.create(
    name="PayPal Checkout Assistant",
    instructions=f"""
You help users create and capture PayPal orders. When the user wants to make a purchase,
use the create_order tool and share the approval link. After approval, use capture_order.
""",
    model="gpt-4-1106-preview",
    tools=tools
)

# Create thread
thread = client.beta.threads.create()

# Start or retrieve a run
run = client.beta.threads.runs.retrieve(thread_id=thread.id, run_id=run.id)
```

Examples for OpenAI's Agent SDK are included in [/examples](/examples).

[app-keys]: https://developer.paypal.com/dashboard/applications/sandbox

## Disclaimer
AI-generated content may be inaccurate or incomplete. Users are responsible for independently verifying any information before relying on it. PayPal makes no guarantees regarding output accuracy and is not liable for any decisions, actions, or consequences resulting from its use.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "paypal-agent-toolkit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "paypal, payments, checkout, api",
    "author": null,
    "author_email": "PayPal <support@paypal.com>",
    "download_url": "https://files.pythonhosted.org/packages/c0/52/224a32946cb48c951f7d1426f0e902f5cff1989bcff6d05425e000341784/paypal_agent_toolkit-1.0.0.tar.gz",
    "platform": null,
    "description": "# PayPal Agentic Toolkit\n\nThe PayPal Agentic Toolkit integrates PayPal's REST APIs seamlessly with OpenAI Agents, allowing AI-driven management of PayPal transactions.\n\n## Available tools\n\nThe PayPal Agent toolkit provides the following tools:\n\n**Orders**\n\n- `create_order`: Create an order in PayPal system based on provided details\n- `get_order`: Retrieve the details of an order\n- `capture_order`: Capture payment for an authorized order\n\n**Products**\n\n- `create_product`: Create a new product in the PayPal catalog\n- `list_products`: List products with optional pagination and filtering\n- `show_product_details`: Retrieve details of a specific product\n- `update_product`: Update an existing product\n\n**Subscription Plans**\n\n- `create_subscription_plan`: Create a new subscription plan\n- `list_subscription_plans`: List subscription plans\n- `show_subscription_plan_details`: Retrieve details of a specific subscription plan\n\n**Subscriptions**\n\n- `create_subscription`: Create a new subscription\n- `show_subscription_details`: Retrieve details of a specific subscription\n- `cancel_subscription`: Cancel an active subscription\n\n\n## Prerequisites\n\nBefore setting up the workspace, ensure you have the following installed:\n- Python 3.11 or higher\n- `pip` (Python package manager)\n- A PayPal developer account for API credentials\n\n## Installation\n\nYou don't need this source code unless you want to modify the package. If you just\nwant to use the package, just run:\n\n```sh\npip install paypal-agent-toolkit\n```\n\n## Usage\n\nThe library needs to be configured with your PayPal developer account's API credentials which is\navailable in your [PayPal Developer Dashboard][app-keys].\n\n```python\nfrom paypal_agent_toolkit.openai.toolkit import PayPalToolkit\nfrom paypal_agent_toolkit.common.configuration import Configuration, Context\n\nconfiguration = Configuration(\n    actions={\n        \"orders\": {\n            \"create\": True,\n            \"get\": True,\n            \"capture\": True,\n        }\n    },\n    context=Context(\n        sandbox=True\n    )\n)\n\n# Initialize toolkit\ntoolkit = PayPalToolkit(client_id=PAYPAL_CLIENT_ID, secret=PAYPAL_SECRET, configuration = configuration)\n\n```\n\nThis toolkit is designed to work with OpenAI's Agent SDK and Assistant API. It provides pre-built tools for managing PayPal transactions like creating, capturing, and checking orders details etc.\n\n\n### Using with OpenAI Agent SDK\n```python\nfrom agents import Agent\n\ntools = toolkit.get_tools()\n\nagent = Agent(\n    name=\"PayPal Assistant\",\n    instructions=\"\"\"\n    You're a helpful assistant specialized in managing PayPal transactions:\n    - To create orders, invoke create_order.\n    - After approval by user, invoke capture_order.\n    - To check an order status, invoke get_order_status.\n    \"\"\",\n    tools=tools\n)\n```\n\n\n### Using with OpenAI Assistants API\n```python\n\ntools = toolkit.get_openai_chat_tools()\npaypal_api = toolkit.get_paypal_api()\n\n# Create assistant\nassistant = client.beta.assistants.create(\n    name=\"PayPal Checkout Assistant\",\n    instructions=f\"\"\"\nYou help users create and capture PayPal orders. When the user wants to make a purchase,\nuse the create_order tool and share the approval link. After approval, use capture_order.\n\"\"\",\n    model=\"gpt-4-1106-preview\",\n    tools=tools\n)\n\n# Create thread\nthread = client.beta.threads.create()\n\n# Start or retrieve a run\nrun = client.beta.threads.runs.retrieve(thread_id=thread.id, run_id=run.id)\n```\n\nExamples for OpenAI's Agent SDK are included in [/examples](/examples).\n\n[app-keys]: https://developer.paypal.com/dashboard/applications/sandbox\n\n## Disclaimer\nAI-generated content may be inaccurate or incomplete. Users are responsible for independently verifying any information before relying on it. PayPal makes no guarantees regarding output accuracy and is not liable for any decisions, actions, or consequences resulting from its use.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A toolkit for agent interactions with PayPal API.",
    "version": "1.0.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/paypal/agent-toolkit/issues",
        "Source Code": "https://github.com/paypal/agent-toolkit"
    },
    "split_keywords": [
        "paypal",
        " payments",
        " checkout",
        " api"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d0dd76853f210cd1825aaadb2c9338ecb1b919160919e40b1dc36564e423b129",
                "md5": "1f2655a9c3f7be17a2f4383d170f6954",
                "sha256": "04a7540306aa339c9ee92340e53f5927c7905a95213b254465b8af6a7a4869d0"
            },
            "downloads": -1,
            "filename": "paypal_agent_toolkit-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1f2655a9c3f7be17a2f4383d170f6954",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 15767,
            "upload_time": "2025-04-18T23:56:12",
            "upload_time_iso_8601": "2025-04-18T23:56:12.954270Z",
            "url": "https://files.pythonhosted.org/packages/d0/dd/76853f210cd1825aaadb2c9338ecb1b919160919e40b1dc36564e423b129/paypal_agent_toolkit-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c052224a32946cb48c951f7d1426f0e902f5cff1989bcff6d05425e000341784",
                "md5": "362a615a293498bf3072fd6bc3b66bad",
                "sha256": "665b329dc67f23f748a2b5034dc5128c3c53981b9e6e714d156fe2cd3d9ca154"
            },
            "downloads": -1,
            "filename": "paypal_agent_toolkit-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "362a615a293498bf3072fd6bc3b66bad",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 13923,
            "upload_time": "2025-04-18T23:56:14",
            "upload_time_iso_8601": "2025-04-18T23:56:14.179216Z",
            "url": "https://files.pythonhosted.org/packages/c0/52/224a32946cb48c951f7d1426f0e902f5cff1989bcff6d05425e000341784/paypal_agent_toolkit-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-04-18 23:56:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "paypal",
    "github_project": "agent-toolkit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "paypal-agent-toolkit"
}
        
Elapsed time: 1.01079s