VietQR Payment Automation for AI Agents: Stripe Alternative

2026-06-14 · AgentPay VN

vietqrai-agentspayment-automationpython-sdkvietnam

Introduction

Accepting payments in Vietnam has traditionally required integrating with international payment gateways like Stripe—each with their own fees, compliance overhead, and integration complexity. But what if you're building AI agents that need to collect payments directly into Vietnamese bank accounts?

Enter AgentPay VN, an open-source Python SDK and MCP server designed specifically for AI agents to collect VietQR payments without ever holding funds. Unlike traditional payment processors, AgentPay VN generates QR codes that point straight to your merchant's bank account, with settlement confirmation via bank feeds.

In this tutorial, we'll walk through how to integrate VietQR payment automation into your AI agent workflows in just three simple steps.

Why AgentPay VN?

Key Advantages

Zero Fund Holding Unlike payment processors that act as intermediaries, AgentPay VN generates QR codes linked directly to your bank account. Money flows straight from customer to merchant—no escrow, no delays, no risk.

Built for AI Agents The SDK is designed to work seamlessly in AI agentic workflows. Create payment requests, generate checkout URLs, and await settlement confirmation—all through clean Python APIs.

Open Source & MIT Licensed Full transparency. No vendor lock-in. Host the MCP server yourself if needed. Audit the code on GitHub.

VietQR Native Leverage VietQR—Vietnam's unified QR payment standard used across all major banks. Your customers already know how to scan and pay.

Perfect for Vietnam While Stripe works globally, AgentPay VN is purpose-built for the Vietnamese market with local bank integration and VietQR compliance baked in.

Getting Started

Installation

Get up and running in seconds:

pip install agentpay-vn

For the MCP server integration (if you're running Claude or another AI agent platform):

pip install agentpay-mcp

The 3-Step Payment Flow

AgentPay VN simplifies payment collection to three core operations:

  1. Create a payment request — Define amount, currency, description
  2. Send checkout URL — Share the QR code link with your customer
  3. Await settlement — Poll or webhook for confirmation when funds arrive

Implementation Guide

Step 1: Create a Payment Request

Here's a practical example of setting up payment collection in your AI agent:

from agentpay_vn import AgentPayClient

# Initialize the client
client = AgentPayClient(
    api_key="your_api_key_here",
    merchant_id="your_merchant_id"
)

# Create a payment request
payment = client.create_payment_request(
    amount=500000,  # 500,000 VND
    currency="VND",
    order_id="order_12345",
    description="AI Agent Service Invoice",
    customer_email="customer@example.com",
    return_url="https://yourapp.com/payment-success"
)

print(f"Payment Request ID: {payment['id']}")
print(f"Checkout URL: {payment['checkout_url']}")

Step 2: Send Checkout URL to Customer

The checkout_url is your payment collection interface. You can:

# Generate QR code from checkout URL
import qrcode

qr = qrcode.QRCode(version=1, box_size=10)
qr.add_data(payment['checkout_url'])
qr.make(fit=True)

img = qr.make_image(fill_color="black", back_color="white")
img.save("payment_qr.png")

Step 3: Await Settlement Confirmation

Poll for payment confirmation once the customer scans and pays:

import time

# Poll for settlement (max 10 attempts, 30-second intervals)
for attempt in range(10):
    status = client.check_settlement(payment_id=payment['id'])

    if status['settled']:
        print(f"✓ Payment confirmed!")
        print(f"Amount received: {status['amount']} VND")
        print(f"Settlement time: {status['settled_at']}")
        break

    print(f"Waiting for settlement... (attempt {attempt + 1}/10)")
    time.sleep(30)
else:
    print("Payment not confirmed within timeout")

MCP Server Configuration

If you're integrating with Claude or another MCP-compatible AI platform:

{
  "mcpServers": {
    "agentpay": {
      "command": "python",
      "args": ["-m", "agentpay_mcp.server"],
      "env": {
        "AGENTPAY_API_KEY": "your_api_key_here",
        "AGENTPAY_MERCHANT_ID": "your_merchant_id"
      }
    }
  }
}

Once configured, your AI agent can call: - agentpay_create_payment_request - agentpay_get_checkout_url - agentpay_check_settlement

Directly from its tool set.

Real-World Use Cases

AI Invoice Bot Automate invoice generation and payment collection. When a customer agrees to pay, the agent creates a payment request and sends the VietQR checkout link.

Subscription Management Agent Periodically create payment requests for recurring services. Confirm receipt of funds before continuing service.

E-commerce AI Assistant Customer asks to complete a purchase. Agent generates VietQR payment link, waits for settlement, then confirms order.

Vendor Payout Automation Pay your marketplace vendors directly to their bank accounts using VietQR, bypassing intermediary payment processors.

FAQ

Q: Does AgentPay VN hold my money? No. The QR code points directly to your merchant bank account. Funds bypass AgentPay entirely.

Q: How do I know when payment settled? Settlement is confirmed via bank feed API. You can poll check_settlement() or set up webhooks for real-time notifications.

Q: Can I use this outside Vietnam? AgentPay VN is optimized for VietQR and Vietnamese banks. International payments are not currently supported.

Q: What's the transaction fee? No AgentPay fees. You pay only your bank's standard VietQR transaction fees (typically 0-0.5%).

Q: Is it really open source? Yes. MIT license. Full source on GitHub. Self-host the MCP server if desired.

Q: How do I get an API key? Sign up at agentpay.servicesai.vn and generate credentials from your dashboard.

Next Steps

Ready to integrate VietQR payment automation into your AI agents?

  1. Install the SDK: pip install agentpay-vn
  2. Read the full docs: agentpay.servicesai.vn/v1/docs
  3. Explore examples: Check the GitHub repository for sample integrations
  4. Join the community: Star the repo and open issues with feedback

AgentPay VN eliminates payment complexity for AI agents operating in Vietnam. No more wrestling with Stripe fees or international processor delays—just direct, secure, VietQR-powered transactions.

Start building today.

Get started →

← All posts