Skip to main content
Glama

💳 unified-pay-cli

Stripe、Razorpay、LemonSqueezy 向けのユニバーサル決済ゲートウェイ CLI & Model Context Protocol (MCP) サーバー。

npm version License: MIT MCP Protocol PRs Welcome


🚀 ハイライト

  • ⚡ インストール不要: npx unified-pay-cli で必要なときにすぐに実行できます。

  • 🎯 マルチプロバイダーエンジン: Stripe、Razorpay、LemonSqueezy にわたる標準化されたインターフェース。

  • 🛠️ スマートな決済リンク生成: 対話型ターミナル UI プロンプト、または直接スクリプト化された CLI フラグ。

  • 🔄 トランザクションと返金の完全なライフサイクル: ライブステータス確認、最近のトランザクション一覧、一部/全額返金、専用の返金進捗トラッキング。

  • 📡 Webhook ステーション & 転送プロキシ: 組み込みの HTTP リスナー (pay listen) が Webhook イベントを傍受し、色分けして、ローカルバックエンド (--forward http://localhost:3000/api/webhooks) に直接転送します。

  • 🔒 暗号署名検証: 組み込みの HMAC-SHA256 検証 (--secret) により、偽造または改ざんされた Webhook ペイロードからローカル開発を保護します。

  • 🤖 ネイティブ Model Context Protocol (MCP): 決済スタックを GitHub Copilot、Cursor、Claude Desktop に接続して、AI が自然言語プロンプトからリンクの作成、署名の検証、請求書の追跡を行えるようにします。


Related MCP server: MCP Billing Gateway SDK

⚡ クイックスタート

1. インストール

グローバルにインストールするか、npx で必要なときに実行します:

# Global install (recommended for daily CLI use)
npm install -g unified-pay-cli

# Or run instantly with npx
npx unified-pay-cli --help

2. 認証情報の設定

# Stripe
pay config --stripe-key sk_test_51...

# Razorpay
pay config --razorpay-id rzp_test_... --razorpay-secret ...

# LemonSqueezy (Optional)
pay config --lemonsqueezy-key lms_... --lemonsqueezy-store 12345

💻 CLI コマンドリファレンス

1. 決済リンクの作成 (pay link)

# Interactive mode (prompts for provider, amount, description)
pay link

# Scriptable flag mode
pay link --provider razorpay --amount 350000 --currency INR --desc "2-Hour Technical Consultation"
pay link --provider stripe --amount 2500 --currency USD --desc "Pro Tier Subscription"

2. トランザクションの確認 (pay txn)

# List recent transactions
pay txn list --provider razorpay --limit 5

# Check specific payment details
pay txn status pay_Oq7Jk8LmNx9 --provider razorpay

3. 返金の発行と追跡 (pay refund)

pay は、チャージと返金エンティティのそれぞれ別のライフサイクルを処理します:

# Issue a refund (full or partial in minor units)
pay refund create pay_Oq7Jk8LmNx9 --provider razorpay --amount 10000

# Track live refund progression
pay refund status rfnd_TRNTRFvhQ6NDKx --provider razorpay

# List all past refunds
pay refund list --provider razorpay

4. Webhook ステーション、検証、プロキシ (pay listen)

複雑なトンネリング設定なしで、ローカル開発中にリアルタイムの Webhook イベントをキャッチします:

# 1. Basic listener
pay listen --port 4242

# 2. Listener with HMAC-SHA256 signature verification
pay listen --port 4242 --secret my_webhook_signing_secret

# 3. Listener with signature verification + proxy forwarding to local backend
pay listen --port 4242 --secret my_webhook_secret --forward http://localhost:3000/api/webhooks

🤖 Model Context Protocol (MCP) 統合

AI アシスタントを自律的な請求・決済オペレーターに変えます。

1. Claude Desktop (claude_desktop_config.json) / Cursor (mcp.json) の場合

{
  "mcpServers": {
    "unified-pay": {
      "command": "npx",
      "args": ["-y", "unified-pay-cli"]
    }
  }
}

2. VS Code Copilot (.vscode/mcp.json) の場合

{
  "servers": {
    "unified-pay": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "unified-pay-cli"]
    }
  }
}

3. 利用可能な AI ツール

ツール名

説明

create_payment_link

カスタム金額、通貨、メモ付きのチェックアウト URL を作成します。

list_transactions

最近のチャージと検証ステータスを取得します。

get_payment_status

特定の支払い ID (pay_xxx, ch_xxx) のライフサイクル状態を検査します。

create_refund

全額または一部の返金をトリガーします。

get_refund_status

返金 ID (rfnd_xxx, re_xxx) のライブステータスを追跡します。

list_refunds

過去の返金記録を一覧表示します。

verify_webhook_signature

受信した Stripe/Razorpay ペイロードの HMAC-SHA256 の真正性を検証します。

4. AI プロンプトの例

Use unified-pay to generate a INR 3,500 Razorpay payment link for "2-Hour Technical Consultation" and draft a WhatsApp message for the client.
Check if payment ID pay_Oq7Jk8LmNx9 on Razorpay was successfully captured.
Issue a full refund for Stripe charge ch_3Mtw1234 using unified-pay.
Verify if this incoming Razorpay webhook payload and signature are authentic using my signing secret.

🧪 テストと検証

# Run unit tests
npm test

# Run tests in watch mode
npm run test:watch

🛠️ 開発

# 1. Clone the repository
git clone https://github.com/your-username/unified-pay-cli.git
cd unified-pay-cli

# 2. Install dependencies
npm install

# 3. Build TypeScript
npm run build

# 4. Symlink globally for local testing
npm link

📄 ライセンス

MIT ライセンスの下で配布されています。詳細は LICENSE を参照してください。

Available Tools

7 tools
compare_gateway_feesA

Evaluates and compares the transaction processing fees, percentage cuts, fixed interchange fees, and estimated net payouts across Stripe, Razorpay, and LemonSqueezy for a given transaction amount and currency. Returns an itemized fee breakdown for each supported gateway alongside the recommended lowest-cost provider.

Inputs: amount (required), currency (required).

create_itemized_invoiceA

Constructs a multi-item commercial invoice checkout link containing itemized product line descriptions, per-unit pricing, item quantities, total tax calculations, and customer billing details. Returns the generated hosted invoice payment URL and itemized receipt breakdown.

Inputs: items (required), customerEmail (required), currency, provider.

create_refundA

Executes an immediate full or partial monetary refund for a previously settled payment or charge transaction across supported payment gateways. Returns a JSON confirmation object containing the refund ID, status, refunded amount, and currency.

Inputs: provider (required), paymentId (required), amount.

get_payment_analyticsA

Aggregates real-time transaction performance, total gross volume, captured revenue volume, settled payouts, and payment success/conversion rates by querying recent transaction histories across connected payment gateway accounts. Returns statistical aggregates and settlement ratios.

Inputs: provider (required), limit.

trigger_mock_webhookA

Constructs and dispatches a cryptographically authentic HMAC-SHA256 signed synthetic webhook event payload directly to a local or remote backend endpoint. Useful for verifying webhook signature parsing, event processing handlers, and local integration pipelines without executing live card charges. Returns the HTTP status code, response headers, and response body received from the target server.

Inputs: event (required), provider (required), targetUrl (required), amount, +1 more.

verify_webhook_signatureA

Validates the cryptographic HMAC-SHA256 signature and tamper-resistance of an incoming webhook HTTP request payload against a shared webhook signing secret. Returns a JSON boolean indicating whether the signature matches the payload digest.

Inputs: secret (required), provider (required), signature (required), rawPayload (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 7 tools

    Disambiguation4/5

    Most tools are clearly distinct, but create_payment_link and create_itemized_invoice both generate hosted checkout URLs, potentially causing confusion. Other tools (fees, webhooks, refunds, analytics) have clear boundaries.

    Naming Consistency5/5

    All tools follow a consistent verb_noun snake_case pattern (create_, compare_, trigger_, verify_, get_). The naming is uniform and predictable across the entire set.

    Tool Count5/5

    Seven tools is a well-scoped size for a payment CLI, covering common operations without overwhelming the user. Each tool addresses a distinct payment workflow, making the count appropriate.

    Completeness3/5

    Core operations like creating payments, refunds, and webhook verification are covered, but there are notable gaps such as no way to retrieve a payment by ID or list past payments. This forces agents to rely on analytics for status, which is a workaround rather than a direct access pattern.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Centralizes payment gateway integrations for Pagar.me (customers, recipients, Pix, credit card, splits, charges) and Woovi/OpenPix (Pix charges, refunds, webhook verification) through MCP tools.
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      Universal billing gateway for MCP servers. Add Stripe subscription billing to any MCP server with one line of code. Supports tiered plans, usage tracking, and automatic access control.
      1
      22 PyPI
      2
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      An MCP (Model Context Protocol) server that connects AI assistants like Claude directly to your Razorpay account.
      14
      27 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      A remote MCP server that lets any AI agent accept payments in India via UPI, cards, netbanking, and wallets through Razorpay Payment Links. Bring your own credentials, stateless, no funds touched.
      MIT