Featured

Deploy OpenClaw in 60 seconds β€” 20% off logoDeploy OpenClaw in 60 seconds β€” 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger β†’
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger β†’
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free β†’
6,000+ web scrapers for your AI agent, start free logo6,000+ web scrapers for your AI agent, start free

Apify gives your agent live web data: 6,000+ prebuilt scrapers and actors, MCP-ready. Sign up free with $5 in usage credits.

Try Apify free β†’
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data β€” no proxies, no parsers, no maintenance.

Start building free β†’
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it β€” secured from day one.

Get it set up for you β†’
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free β†’
Reach 48,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here β†’

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

phuocdu/agentpay-vn MCP server](https://glama.ai/mcp/servers/phuocdu/agentpay-vn/badges/score.svg)](https://glama.ai/mcp/servers/phuocdu/agentpay-vn) 🐍 ☁️ - VietQR payments for AI agents in Vietnam.

README.md

AgentPay VN

<!-- mcp-name: io.github.phuocdu/agentpay-vn -->

![PyPI version](https://pypi.org/project/agentpay-vn/) ![License: MIT](LICENSE) ![MCP Registry](https://registry.modelcontextprotocol.io/v0/servers?search=agentpay-vn) ![phuocdu/agentpay-vn MCP server](https://glama.ai/mcp/servers/phuocdu/agentpay-vn)

VietQR payment infrastructure for AI agents β€” collect money inside any conversation.

AgentPay VN lets AI agents (Claude, GPT, custom bots) generate payment QR codes, send them to users, and automatically confirm when the money arrives β€” all without ever holding or touching funds. Money flows directly from the payer's bank account into the merchant's account; AgentPay only reads the bank transaction feed to confirm settlement.

Status: Early access / self-hosted β€” running on the same swarm as Sα»• Nợ AI.

---

How it works

AI Agent                   AgentPay API              Bank feed (SePay)
   |                            |                           |
   |-- create_payment_request ->|                           |
   |<- { qr_image_url, id } ----|                           |
   |                            |                           |
   |-- send QR to user -------->|                           |
   |                            |      user scans & pays    |
   |                            |<-- webhook (bank txn) ----|
   |                            |-- match AP* pay_code      |
   |                            |-- status β†’ settled        |
   |<-- await_settlement done --|                           |
   |                            |                           |
   |-- deliver order / unlock ->|                           |
  1. Create β€” agent calls POST /v1/payment-requests β†’ gets a VietQR image URL and a checkout page.
  2. Send β€” agent embeds the QR image or sends the checkout link to the user in chat.
  3. Await β€” agent calls await_settlement() (or the MCP tool) to poll until status = settled.
  4. Deliver β€” only after confirmed settlement does the agent release the goods/service.

AgentPay never holds money. The QR points directly at the merchant's bank account number. The platform only monitors the bank transaction feed to detect matching transfers.

---

Quick start

1. Install

pip install agentpay-vn

2. Set your API key

export AGENTPAY_API_KEY=ap_test_xxx   # sandbox key for testing

Get a key from the admin dashboard (self-hosted) or contact the platform operator.

3. Collect a payment (3 lines)

from agentpay.client import AsyncAgentPayClient, await_settlement
import asyncio

async def main():
    async with AsyncAgentPayClient("ap_test_xxx") as client:
        pr = await client.create_payment_request(amount=50_000, description="Order #1")
        print(pr["checkout_url"])          # send this link to your user
        result = await await_settlement(client, pr["id"], timeout=120)
        assert result["status"] == "settled"

asyncio.run(main())

See examples/quickstart.py for the full runnable version.

---

MCP server setup

AgentPay ships an MCP server so any MCP-compatible AI agent can call it as a tool β€” no extra code needed.

Claude Desktop / Claude Code

Add to claude_desktop_config.json (or use examples/claude_desktop_config.json):

{
  "mcpServers": {
    "agentpay": {
      "command": "python",
      "args": ["-m", "agentpay.mcp_server"],
      "env": {
        "AGENTPAY_API_KEY": "ap_test_xxx",
        "AGENTPAY_BASE_URL": "https://agentpay.servicesai.vn/v1"
      }
    }
  }
}

Or use the installed console script:

{
  "mcpServers": {
    "agentpay": {
      "command": "agentpay-mcp",
      "env": { "AGENTPAY_API_KEY": "ap_live_xxx" }
    }
  }
}

Available MCP tools

| Tool | Description | |------|-------------| | create_payment_request | Generate a VietQR code for a given amount | | check_payment | Get current status of a payment request | | await_settlement | Poll until payment arrives or timeout (max 600 s) | | list_recent_payments | List last N settled transactions |

---

Python SDK

Synchronous

from agentpay.client import AgentPayClient

with AgentPayClient("ap_live_xxx") as client:
    # Create
    pr = client.create_payment_request(
        amount=150_000,
        description="Consulting session 30 min",
        ttl_minutes=30,
        idempotency_key="session-abc-123",
    )

    # Poll manually
    import time
    for _ in range(60):
        pr = client.get_payment_request(pr["id"])
        if pr["status"] != "pending":
            break
        time.sleep(5)

    # Reconcile
    txns = client.list_transactions(limit=10)

Asynchronous

from agentpay.client import AsyncAgentPayClient, await_settlement

async with AsyncAgentPayClient("ap_live_xxx") as client:
    pr = await client.create_payment_request(amount=75_000, description="eBook download")
    result = await await_settlement(client, pr["id"], timeout=300)
    if result["status"] == "settled":
        send_download_link(result["metadata"].get("email"))

Webhook verification

import hashlib, hmac

def verify_webhook(raw_body: bytes, signature_header: str, secret: str) -> bool:
    expected = hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, signature_header)

Register a webhook endpoint:

ep = client.register_webhook(
    url="https://your-server.com/webhooks/agentpay",
    events=["payment.settled", "payment.expired"],
)
print(ep["secret"])  # store this β€” shown only once

---

API reference

  • OpenAPI spec: agentpay-openapi.yaml
  • Base URL: https://agentpay.servicesai.vn/v1
  • Authentication: Authorization: Bearer ap_live_xxx (or ap_test_xxx for sandbox)

Key endpoints

| Method | Path | Description | |--------|------|-------------| | POST | /v1/payment-requests | Create payment request | | GET | /v1/payment-requests/{id} | Get status | | POST | /v1/payment-requests/{id}/cancel | Cancel pending request | | GET | /v1/transactions | List settled transactions | | POST | /v1/webhook-endpoints | Register webhook URL | | POST | /v1/sandbox/simulate-settlement | Simulate payment (sandbox only) | | GET | /pay/{pay_code} | Public checkout page (HTML, mobile-friendly) |

---

Self-hosting

AgentPay runs as part of the Sα»• Nợ AI FastAPI backend.

Requirements

  • Docker Swarm cluster (same as Sono)
  • MongoDB (shared with Sono)
  • SePay bank feed account (for live payments)
  • Nginx with an agentpay.servicesai.vn vhost

Environment variables

| Variable | Default | Description | |----------|---------|-------------| | AGENTPAY_BASE_URL | https://agentpay.servicesai.vn | Public base URL for checkout links | | MONGO_URI | mongodb://localhost:27017 | Inherited from Sono | | BILLING_WEBHOOK_TOKEN | β€” | SePay webhook token (inherited) |

Create an API key (admin)

curl -X POST https://sono.servicesai.vn/api/admin/agentpay/keys \
  -H "Authorization: Bearer <admin-jwt>" \
  -H "Content-Type: application/json" \
  -d '{"org_id": "<shop-user-id>", "name": "My bot", "livemode": true}'

The response includes the full key β€” store it immediately; it is shown only once.

---

Rate limits

| Tier | Settled payments/month | Requests/minute | |------|----------------------|-----------------| | Free | 50 | 120 |

---

Design principles

  1. No money held β€” QR codes point directly at the merchant's bank account. AgentPay only reads the transaction feed; it never touches the money.
  1. Idempotency β€” pass an Idempotency-Key header on POST /payment-requests to safely retry without creating duplicates (24-hour deduplication window).
  1. HMAC webhook verification β€” every outbound webhook is signed with HMAC-SHA256(whsec_..., raw_body) in the AgentPay-Signature header. Always verify before processing.
  1. Sandbox β€” use ap_test_* keys and POST /v1/sandbox/simulate-settlement to develop and test without real transactions.
  1. Minimal trust surface β€” the MCP server is a thin REST client with no local secrets beyond the API key. Compromising an agent key only exposes one tenant's payment-request creation ability.

---

License

MIT Β© 2026 ServicesAI β€” see LICENSE.

See related servers & alternatives β†’

Related MCP servers

Browse all β†’

Related guides

Hand-picked reading to help you choose and use Developer Tools servers.