VietQR Payment Automation for AI Agents: Stripe Alternative
Why VietQR Payments for AI Agents?
Payment processing in Vietnam has traditionally relied on third-party gateways like Stripe, which come with international fees and complexity. AgentPay VN changes this by enabling AI agents to collect payments directly through VietQR—Vietnam's native, bank-agnostic QR code standard.
Unlike payment processors that hold funds, AgentPay VN generates QR codes that point directly to your merchant bank account. Settlement confirmation comes via your bank feed, making the flow transparent and cost-effective.
What is AgentPay VN?
AgentPay VN is an open-source (MIT-licensed) Python SDK paired with an MCP (Model Context Protocol) server. It bridges AI agents and Vietnamese banking infrastructure, eliminating intermediaries and associated fees.
Key characteristics: - No fund holding: QR codes redirect straight to your bank account - Bank-verified settlement: Confirmation via bank feeds, not proprietary APIs - Open source: Full transparency and community-driven development - AI-native: Designed specifically for autonomous agent workflows - Easy integration: Three-line payment flow
Getting Started
Installation
Install the SDK via pip:
pip install agentpay-vn
For MCP server support (recommended for AI agent integration):
pip install agentpay-mcp
Core Concepts
AgentPay VN operates on three main concepts:
- Payment Request: Define what you're charging for
- Checkout URL: Share the VietQR link with your customer
- Settlement Confirmation: Listen for bank feed confirmation
Python SDK Example
Here's a minimal example of collecting a payment:
from agentpay_vn import PaymentClient
import asyncio
# Initialize the client
client = PaymentClient()
async def collect_payment():
# Step 1: Create payment request
payment = await client.create_payment_request(
amount=100000, # VND
description="Premium AI Model Access - Monthly",
merchant_id="your_merchant_id",
order_id="order_12345"
)
# Step 2: Send checkout URL to customer
checkout_url = payment.checkout_url
print(f"Send this link to customer: {checkout_url}")
# In a real agent: send via email, SMS, or display in UI
# Step 3: Wait for settlement confirmation
settlement = await client.await_settlement(
payment_id=payment.id,
timeout_seconds=3600
)
if settlement.confirmed:
print(f"Payment received: {settlement.amount} VND")
# Unlock premium features, grant access, etc.
else:
print("Payment timeout or cancelled")
# Run the async flow
asyncio.run(collect_payment())
Integrating with AI Agent Frameworks
AgentPay VN ships with an MCP server, making it compatible with Claude, other Claude-like LLMs, and custom AI agents.
MCP Server Configuration
Add this to your agent's MCP configuration file:
{
"mcpServers": {
"agentpay-vn": {
"command": "python",
"args": ["-m", "agentpay_mcp"],
"env": {
"AGENTPAY_MERCHANT_ID": "your_merchant_id",
"AGENTPAY_BANK_ACCOUNT": "your_bank_account"
}
}
}
}
Once configured, your AI agent can access payment tools directly:
# Pseudo-code for agent integration
agent.tools["create_vietqr_payment"](amount=50000, description="API credits")
agent.tools["check_payment_status"](payment_id="abc123")
Use Cases
SaaS Billing for Vietnamese Users
Automate subscription collection without Stripe fees (typically 2.9% + $0.30).
AI Agent Monetization
Let agents autonomously collect payment before providing premium services (e.g., custom analysis, report generation).
E-commerce Integration
Build direct payment flows into AI-powered shopping assistants that operate in Vietnam.
B2B Invoicing
Automated invoice generation with instant VietQR payment links.
How Settlement Verification Works
AgentPay VN doesn't verify payments through proprietary APIs. Instead:
- Customer scans QR → Transfers to your merchant account
- Bank processes transfer → Normal banking infrastructure
- Your bank feed updates → AgentPay VN watches this feed
- Settlement confirmed → SDK receives confirmation
This approach is more secure because it leverages your bank's authority, not a third-party gateway.
VietQR vs. Other Payment Methods
| Feature | VietQR + AgentPay VN | Stripe | Momo |
|---|---|---|---|
| Local bank account required | Yes | No | No |
| Fund holding | No | Yes | Yes |
| Vietnam-native | Yes | No | Yes |
| Open source | Yes | No | No |
| AI-friendly SDK | Yes | Yes | Partial |
| Settlement speed | Instant (banking) | 1-2 days | Instant |
FAQ
Q: Is AgentPay VN safe to use in production? A: Yes. The code is open source (MIT license), meaning anyone can audit it. Settlement verification relies on your bank's infrastructure, which is inherently secure.
Q: Do I need a business bank account? A: VietQR works with most Vietnamese business accounts. Check with your bank's support for VietQR QR generation capabilities.
Q: What if a customer doesn't pay?
A: The await_settlement() function will timeout. Your agent can programmatically handle this by refusing service, requesting payment again, or escalating to a human.
Q: Can I customize the QR code design? A: VietQR codes are standardized by Vietnamese banking regulations, but AgentPay VN allows custom branding in the checkout experience.
Q: How do I handle refunds? A: Refunds are processed through normal banking channels. AgentPay VN tracks settlement; your bank handles the reverse transaction.
Next Steps
Ready to automate payments for your Vietnamese users?
- Install the SDK:
pip install agentpay-vn - Read the full documentation: https://agentpay.servicesai.vn/v1/docs
- Explore the source code: https://github.com/phuocdu/agentpay-vn
- Integrate with your agent: Set up the MCP server and start collecting payments
AgentPay VN makes Vietnamese payments as simple as three lines of code. No intermediaries, no foreign fees, no complexity—just direct bank transfers verified by your bank feed.
Start building payment-aware AI agents today.