AgentPay VN is a VietQR payment channel designed for AI agents, providing a Python SDK and an MCP server, with the goal of completing collection in any conversation.
Purpose AgentPay VN enables AI agents (Claude, GPT, custom bots) to generate payment QR codes, send them to users, and automatically confirm once funds arrive—all without holding or touching funds. Funds flow directly from the payer's bank account into the merchant account; AgentPay only reads bank transaction records to confirm settlement.
Main capabilities
- Create: The agent calls POST /v1/payment-requests to obtain the VietQR image URL and checkout page.
- Send: The agent embeds the QR code image in the chat or sends the checkout link.
- Wait: The agent calls await_settlement() (or the MCP tool) to poll until the status becomes settled.
- Deliver: Only after confirming settlement does the agent release the goods or services. AgentPay never holds funds. The QR code points directly to the merchant's bank account number, and the platform only monitors bank transaction records to detect matching transfers.
How to use
- Install: See the installation instructions and examples in the repository (such as examples/quickstart.py).
- Set the API key: Obtain the key from the self-hosted admin dashboard, or contact the platform operator.
- Collect payment (3 lines of code): See examples/quickstart.py for a fully runnable version.
- MCP server setup: AgentPay comes with an MCP server, and any MCP-compatible AI agent can call it as a tool without additional code.
- Claude Desktop / Claude Code: Add it to claude_desktop_config.json (or use examples/claude_desktop_config.json), or use the installed console script.
- Available MCP tools.
- Webhook verification: Register a Webhook endpoint.
- OpenAPI specification: agentpay-openapi.yaml
- Base URL:https://agentpay.servicesai.vn/v1
- Authentication: Authorization: Bearer ap_live_xxx (use ap_test_xxx for sandbox)
Deployment environment AgentPay runs as part of the Sổ Nợ AI FastAPI backend, including: Docker Swarm cluster (same as Sono), MongoDB (shared with Sono), SePay bank transaction account (for real-time payments), Nginx with the agentpay.servicesai.vn virtual host. Environment variables must be configured yourself.
Create API key (admin) The response contains the full key, which must be saved immediately; the key is shown only once.
Design principles
- No holding of funds: The QR code points directly to the merchant bank account, and AgentPay only reads transaction records and never touches funds.
- Idempotency: Pass the Idempotency-Key header on POST /payment-requests to safely retry without creating duplicates (24-hour deduplication window).
- HMAC Webhook verification: Every outbound Webhook is signed using HMAC-SHA256(whsec_..., raw_body), placed in the AgentPay-Signature header. Always verify before processing.
- Sandbox: Use ap_test_* keys and POST /v1/sandbox/simulate-settlement to develop and test without real transactions.
- Minimal trust surface: The MCP server is a lightweight REST client with no local secrets other than the API key. Leakage of an agent key only exposes the payment request creation capability of a single tenant.
License MIT © 2026 ServicesAI — see LICENSE for details.