@yuno-payments/agent-toolkit
v0.1.0
Published
> AI framework integrations for the Yuno payment platform
Readme
@yuno-payments/agent-toolkit
AI framework integrations for the Yuno payment platform
The Yuno Agent Toolkit enables popular AI agent frameworks including Vercel AI SDK and Google Genkit to integrate with Yuno payment APIs through function calling. Built with TypeScript and designed for excellent developer experience with full type safety.
Features
- 🚀 Multiple Framework Support - Works with Vercel AI SDK and Google Genkit
- 🔒 Type-Safe - Full TypeScript support with comprehensive types
- 📦 Modular - Import only what you need (customers, payments, etc.)
- 🎯 Modern - Built on latest dependencies and best practices
- 🔧 Easy Setup - Simple configuration with environment variables
- 📚 Well Documented - Comprehensive examples and API documentation
Installation
npm install @yuno-payments/agent-toolkitRequirements
- Node.js 18+
- A Yuno account with API credentials (Sign up here)
Quick Start
Vercel AI SDK
import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";
import { yunoAgentToolkit } from "@yuno-payments/agent-toolkit/ai-sdk";
// Initialize the toolkit
const yunoToolkit = yunoAgentToolkit({
accountCode: process.env.YUNO_ACCOUNT_CODE!,
publicApiKey: process.env.YUNO_PUBLIC_API_KEY!,
privateSecretKey: process.env.YUNO_PRIVATE_SECRET_KEY!,
});
// Use all tools or specific categories
const tools = yunoToolkit.allTools();
// const tools = yunoToolkit.customers(); // Only customer tools
// const tools = yunoToolkit.payments(); // Only payment tools
// Generate text with AI
const { text } = await generateText({
model: openai("gpt-4"),
tools,
maxSteps: 10,
prompt: "Create a customer named John Doe with email [email protected]",
});
console.log(text);Google Genkit
import { genkit } from "genkit";
import { googleAI, gemini15Pro } from "@genkit-ai/googleai";
import { yunoGenkitToolkit } from "@yuno-payments/agent-toolkit/genkit";
// Initialize Genkit
const ai = genkit({ plugins: [googleAI()] });
// Initialize the toolkit
const yunoToolkit = yunoGenkitToolkit({
accountCode: process.env.YUNO_ACCOUNT_CODE!,
publicApiKey: process.env.YUNO_PUBLIC_API_KEY!,
privateSecretKey: process.env.YUNO_PRIVATE_SECRET_KEY!,
ai,
});
// Define a prompt with tools
const myAgent = ai.definePrompt({
name: "paymentAgent",
model: gemini15Pro,
tools: yunoToolkit.getToolsArray(),
input: {
schema: z.object({
query: z.string(),
}),
},
});
// Execute
const result = await myAgent({ query: "Create a payment for $50" });
console.log(result.text);Available Tools
The Yuno AI provides comprehensive access to Yuno's payment platform:
Customer Management
customerCreate- Create a new customercustomerRetrieve- Retrieve customer by IDcustomerRetrieveByExternalId- Retrieve by external IDcustomerUpdate- Update customer information
Payment Processing
paymentCreate- Create a paymentpaymentRetrieve- Retrieve payment informationpaymentRetrieveByMerchantOrderId- Retrieve by merchant order IDpaymentRefund- Refund a paymentpaymentCancel- Cancel a pending paymentpaymentAuthorize- Authorize a paymentpaymentCaptureAuthorization- Capture authorized payment
Checkout Sessions
checkoutSessionCreate- Create a checkout sessioncheckoutSessionCreateOtt- Generate One-Time TokencheckoutSessionRetrievePaymentMethods- Get available payment methods
Payment Methods
paymentMethodEnroll- Enroll a payment methodpaymentMethodRetrieve- Retrieve payment methodpaymentMethodRetrieveEnrolled- List enrolled methodspaymentMethodUnenroll- Remove a payment method
Subscriptions
subscriptionCreate- Create a subscriptionsubscriptionRetrieve- Get subscription detailssubscriptionUpdate- Update subscriptionsubscriptionPause- Pause subscriptionsubscriptionResume- Resume subscriptionsubscriptionCancel- Cancel subscription
Payment Links
paymentLinkCreate- Create a payment linkpaymentLinkRetrieve- Get payment link detailspaymentLinkCancel- Cancel a payment link
And more...
- Recipients management
- Installment plans
- Routing configuration
Usage
Selective Tool Loading
You can load only the tools you need:
// Load all tools
const allTools = yunoToolkit.allTools();
// Load specific categories
const customerTools = yunoToolkit.customers();
const paymentTools = yunoToolkit.payments();
const subscriptionTools = yunoToolkit.subscriptions();
// Get a single tool
const createCustomerTool = yunoToolkit.getTool("customerCreate");Environment Variables
Set your Yuno credentials:
YUNO_ACCOUNT_CODE=your_account_code
YUNO_PUBLIC_API_KEY=your_public_api_key
YUNO_PRIVATE_SECRET_KEY=your_private_secret_keyGet your credentials from the Yuno Dashboard.
Examples
Check out the examples directory for complete working examples:
- Vercel AI SDK - Basic usage, streaming, multi-step workflows
- Google Genkit - Prompts, tools, and flows
API Reference
Vercel AI SDK
import { yunoAgentToolkit } from "@yuno-payments/agent-toolkit/ai-sdk";
const toolkit = yunoAgentToolkit(config);Methods:
allTools()- Get all available toolscustomers()- Get customer management toolspayments()- Get payment processing toolscheckoutSessions()- Get checkout session toolspaymentMethods()- Get payment method toolssubscriptions()- Get subscription toolspaymentLinks()- Get payment link toolsrecipients()- Get recipient toolsinstallmentPlans()- Get installment plan toolsrouting()- Get routing tools
Google Genkit
import { yunoGenkitToolkit } from "@yuno-payments/agent-toolkit/genkit";
const toolkit = yunoGenkitToolkit(config);Methods: (Same as Vercel AI SDK, plus)
getToolsArray(genkitInstance?)- Get tools as array for Genkit promptsgetTool(toolName, genkitInstance?)- Get a specific tool by name
Architecture
This toolkit is built on top of:
@yuno/yuno-mcp- Core Yuno API tools and schemas- Framework adapters that convert MCP tools to framework-specific formats
Development
# Install dependencies
npm install
# Build
npm run build
# Type checking
npm run typecheck
# Linting
npm run lint
# Testing
npm run test
# Watch mode
npm run devContributing
Contributions are welcome! Please read our Contributing Guide for details.
License
MIT © Yuno Payments
Support
Related Projects
- yuno-mcp - Model Context Protocol server for Yuno
- local-yuno-mcp - Local MCP server
- remote-yuno-mcp - Remote MCP server
Made with ❤️ by Yuno Payments
