Cashfree CLI

Cashfree CLI

Enables AI agents to test Cashfree payment integrations end-to-end by creating orders, simulating payments, listening to webhooks, and verifying signatures via MCP tools.

Category
访问服务器

README

Cashfree CLI

Prove a Cashfree integration works end to end — from your terminal, or from your AI agent.

Built by Mothi Venkatesh — Product Marketing at Cashfree Payments. An agent-native CLI for the developer (and the coding agent) who would rather never open the dashboard.

Most payment CLIs fetch objects. This one proves the loop: create an order, pay it, catch the webhook, verify the signature, and cross-check the API before it says "done." Sandbox by default. Runs fully offline with --mock — no keys, no setup.

git clone https://github.com/mothivenkatesh/cashfree-cli
cd cashfree-cli && npm install && npm run build
node dist/index.js verify --mock
Verifying upi success (mock)
  ✓ order created  order_d5f8…ae97 (ACTIVE)
  ✓ payment initiated  MOCK_pay_db0f…01a0
  ✓ webhook received  signature valid
  ✓ api cross-check  order_status=PAID (expected PAID)
  ✓ artifact  .cashfree/verify-….json

Zero runtime dependencies · Node 20+ · one binary that is also an MCP server.


What it does

  • Closes the integration loop in five commandsinitsimulatelistenverifydoctor. The slow part of a payment integration is testing webhooks and proving it works; this is built for exactly that.
  • One binary, two consumers — a human at a terminal, and an AI agent over MCP. Same commands, same safety, both ways.
  • Runs offline--mock boots a built-in sandbox simulator that signs and delivers real webhooks, so the whole loop runs with no credentials.
  • Agent-native by default--json output (auto-on when piped), semantic exit codes, and structured errors with suggested_fix so an agent self-corrects.
  • A webhook is a signal, not the truthverify always cross-checks the authoritative API before declaring success. Never the webhook payload alone.
  • Grounded in the real APIx-api-version: 2025-01-01, real endpoints, HMAC-SHA256 webhook verification. No invented shapes.

What works today

  • verify — the full loop, validated against the live Cashfree sandbox: real order → pay → simulate → webhook → signature match → API cross-check → typed artifact.
  • Payment Gateway, live-validated: orders create/get, payments list, links create/get, order pay, simulate, refunds create, settlements get + settlements today, disputes order/get.
  • Signed webhook delivery confirmed live — the sandbox delivers signed webhooks; this CLI's signature verification matches Cashfree's exactly.
  • listen — forward webhooks to localhost and verify signatures locally, no ngrok (mock + cross-process proven).
  • Real-mode webhooks via --tunnelverify --tunnel / listen --tunnel open a cloudflared tunnel so live Cashfree webhooks reach localhost; graceful fallback if cloudflared is absent.
  • OpenAPI codegennpm run codegen generates typed defs from Cashfree's live specs (PG/Payouts/Verification) for drift-checking.
  • init — scaffolds .env.example, a webhook handler with real signature verification, and an AGENTS.md so coding agents stop guessing the API.
  • doctor — preflight: credentials, API version, connectivity, mode.
  • mcp serve — exposes the surface as 8 MCP tools over stdio JSON-RPC.
  • 10/10 tests, clean TypeScript build, zero runtime dependencies.

Roadmap — not done yet

  • Secure ID (PAN, bank account, UPI verification) — client built; needs signature auth + IP allowlisting handled for a CLI context; live validation pending.
  • Payouts (transfers, beneficiaries) — client built; needs IP allowlisting + V2 body finalized; live validation pending.
  • Subscriptions (UPI Autopay, plans, mandates) — commands built and grounded in the docs; pending sandbox product enablement; live validation pending.
  • Publish to npm for npx cashfree-cli (package is publish-ready), plus a Homebrew tap.
  • Migrate the client to generated types — the npm run codegen pipeline exists; wiring the client to it is the follow-up.
  • More init languages — Python and PHP scaffolds.

The commands

# the loop
cashfree init                                  # scaffold a working integration + AGENTS.md
cashfree simulate payment --payment-id <id> --status SUCCESS
cashfree listen --forward-to http://localhost:3000/webhook
cashfree verify --outcome success              # prove it works, emit an artifact
cashfree doctor                                # why you are not live yet

# resources (Payment Gateway)
cashfree orders create --amount 100            # orders get <id>
cashfree payments list <order_id>
cashfree refunds create --order <id> --amount 50
cashfree links create --amount 100             # links get <id>
cashfree settlements get <order_id>            # settlements today
cashfree disputes order <order_id>             # disputes get <id>

# roadmap surfaces (built, validation pending)
cashfree payouts transfer --amount 500 --vpa name@bank   # payouts balance
cashfree secureid pan --pan ABCDE1234F --name "Name"
cashfree subscriptions create-plan --amount 499 --interval-type MONTH

# auth + agents
cashfree login --client-id <id> --client-secret <secret>
cashfree mcp serve

Add --mock to run any of it offline. Add --json for machine output.

For AI agents

  • --json on every command, auto-on when stdout is piped (TTY detection).
  • Semantic exit codes: 0 ok · 2 auth · 3 validation · 4 confirmation-required · 6 not-found · 7 rate-limited · 8 network. Branch on them; don't scrape text.
  • Structured errors with suggested_fix and retry_after.
  • cashfree mcp serve — the same surface as MCP tools, same gates.
  • cashfree init writes AGENTS.md with the pinned API version, base URLs, and the "webhook is not the truth" rule.

Safety

  • Sandbox by default. --live is required for production.
  • Live money movement (payouts, refunds) also needs --confirm, so a script or agent never moves real money by accident.
  • Credentials live in a 0600 file (OS keychain hardening on the roadmap), never in argv, never logged.

How it's built

  • TypeScript, compiled with tsc, zero runtime dependencies — even the MCP server is a hand-rolled JSON-RPC stdio loop. Fast, reliable npm install.
  • The real HTTP client and an offline mock sandbox implement one CashfreeClient interface, so the CLI and the MCP server share logic and the whole thing is testable without a network.
  • API shapes are grounded in Cashfree's public SDKs and OpenAPI specs.

Status: community project, not an official Cashfree product (yet). Payment Gateway is validated against the live sandbox; the rest is on the roadmap above. Issues and PRs welcome.

MIT © Mothi Venkatesh

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选