Integrating PayPal Agent Toolkit with Node.js: A Step-by-Step Tutorial

PayPal announces its Agent Toolkit in late April 2025, it is a remarkable step in this Agentic Era, allowing developers to integrate PayPal service or create payment workflow using natural language, making operations more intuitive.

As it is a beginning, I have tried it out with using NodeJS as the programming language and share it in form of a video tutorial:

Video url: https://youtu.be/SXngYSKAJQE

Github Repo: https://github.com/gordonchanhk/PayPal-Agent-Toolkit-Demo

I base on the example code in https://paypal.ai > Agent Toolkit > Docs – https://developer.paypal.com/tools/agent-toolkit/ and walk through the coding from ground. Here are couple highlights, which can act as hint to anyone who encountered trouble when trying out the Agent Toolkit:

  1. The example code doesn’t define getModel() and generateText() clearly. You shall need to define the function definition for getModel(), while generateText() is a AI SDK function.
  2. The Vercel AI SDK example code doesn’t config the Agent Toolkit to use Sandbox mode, you shall need to add 'context': {'sandbox': true} under the configuration node upon instantizing the Agent Toolkit instance.
  3. For some instance, you may need to use a custom AI endpoint and different API Key environment variable, use createOpenAI() instead of openai() allows you to pass apiKey and baseUrl.

My example is just showcasing the most base example. It uses terminal instead of building an interactive webpage with SPA. As a developer you shall define your way how to let user to enter the command / the prompt, and shows the response in a way you wish.

Look forward there are more showcase showing how to use PayPal Agent Toolkit.

To learn more about PayPal’s AI related info, check out https://paypal.ai

Leave a Reply

Your email address will not be published. Required fields are marked *

Please Answer * Time limit is exhausted. Please reload CAPTCHA.