Build AI-powered payment agents with the Cashfree Agent Toolkit for LangChain, Vercel AI SDK, and OpenAI Agents SDK, exposing Cashfree APIs as tool calls.
Use this file to discover all available pages before exploring further.
The Cashfree Payments Agent Toolkit enables popular agent frameworks including LangChain, Vercel’s AI SDK, and OpenAI’s Agents SDK to integrate with Cashfree APIs through function calling. Build AI-powered payment agents that can create orders, process refunds, and manage customers programmatically.
Load all available Cashfree payment tools for comprehensive functionality or select specific tools your application needs for more focused functionality.
import { generateText } from "ai";import { openai } from "@ai-sdk/openai";const result = await generateText({ model: openai("gpt-4o"), tools: { createOrder: cashfreeToolkit.tools.createOrder, getOrder: cashfreeToolkit.tools.getOrder, }, prompt: "Create an order for Rs. 500",});
The following example demonstrates a complete payment agent using the OpenAI Agents SDK:
import { Agent, run } from '@openai/agents';import { CashfreeAgentToolkit, CFEnvironment,} from '@cashfreepayments/agent-toolkit/openai';// Initialize the toolkitconst cashfree = new CashfreeAgentToolkit( CFEnvironment.SANDBOX, process.env.CASHFREE_CLIENT_ID, process.env.CASHFREE_CLIENT_SECRET);// Create an agent with all payment toolsconst agent = new Agent({ name: 'Payment Agent', instructions: 'You are a helpful payment assistant.', model: 'gpt-4o', tools: cashfree.getAgentTools(),});// Run the agentconst result = await run( agent, 'Look up customer cust_123 and create an order for Rs. 500');