VietQR API Integration: Automate Bank Transfers with 0% Fees
"Transfer the money and send me a screenshot!" — This phrase has become a thing of the past thanks to VietQR. Built by NAPAS and Vietnamese banks as a unified QR code standard, it allows generating dynamic QR codes pre-filled with the payment amount and transfer details.
If you want a Fast - Affordable - Convenient payment solution without going through e-wallet intermediaries or payment gateways, the VietQR API is your ideal match.
1. Key Advantages of VietQR
- Real-time settlement: Funds arrive in the seller's account within just 1–3 seconds.
- 0% transaction fee: Most banks today offer free 24/7 transfers. You save 2–3% in fees compared to traditional payment gateways.
- Auto-confirm: With JAYbranding's API, your website automatically detects incoming payments to activate orders—no manual accounting checks required.
2. Two Ways to Integrate VietQR
Method 1: VietQR Static - For small shops
Generate 1 fixed QR code containing your bank account number. Customers scan -> manually enter the amount -> transfer. This method is prone to errors and hard to manage.
Method 2: VietQR Dynamic - For businesses
Each order generates a unique QR code pre-filled with the exact amount and order ID (e.g., DONHANG123). Customers simply tap confirm without typing anything else.
3. How to Integrate VietQR API (Via Casso/SePay)
Since banks do not provide public balance-change APIs for individuals, we need a third-party service (such as Casso or SePay) to "listen" to bank SMS/app notifications and trigger a webhook to your website.
Step 1: Generate a VietQR Link
Use the VietQR.io API to generate the QR Code image.
<code>// Format: https://img.vietqr.io/image/[BANK]-[ACCOUNT]-[TEMPLATE].png?amount=[AMOUNT]&addInfo=[CONTENT]
$bank = "MB";
$account = "0909999999";
$amount = "50000";
$content = "DH12345"; // Short order code
$qr_url = "https://img.vietqr.io/image/$bank-$account-compact.png?amount=$amount&addInfo=$content";
// Display this image to the customer
echo '
';</code></pre>
Step 2: Handle the Webhook (When funds arrive)
<p>When money enters your account, Casso/SePay will send JSON data to your URL.
<code>// File: webhook_vietqr.php
$data = json_decode(file_get_contents('php://input'), true);
if (!empty($data['transactions'])) {
foreach ($data['transactions'] as $trans) {
$amount = $trans['amount']; // Amount received
$description = $trans['description']; // Transfer description: "NGUYEN VAN A CHUYEN KHOAN DH12345..."
// Parse description to extract order ID
preg_match('/DH[0-9]+/', $description, $matches);
if (!empty($matches[0])) {
$orderId = $matches[0];
// Check if the amount matches the order
// If matched -> Update status to "Paid"
// Send thank-you email to the customer
}
}
}
// Respond to Casso confirming receipt
echo json_encode(['success' => true]);</code></pre>
4. Risks to Keep in Mind
- SMS delays: Occasionally, banks send SMS notifications late -> delayed webhooks -> longer wait times for customers.
- Incorrect transfer details: Even with a QR code, customers can still edit the transfer description -> the system cannot auto-match the order. A backup manual verification process is needed.
5. JAYbranding's "VietQR Pro" Solution
<p>We provide a comprehensive VietQR solution that overcomes every limitation:
- ✅ Virtual Account: Each customer or order gets a dedicated virtual account number (e.g., 9999 + Order ID). Even if the customer omits the transfer description, any payment to that number is instantly matched to the right order with 100% accuracy.
- ✅ Real-time WebSocket: Updates the order status on the customer's screen immediately without needing a page reload.
- ✅ Smart Banking Integration: Supports Deep Links to open the customer's banking app (VCB, TCB, MB, etc.) directly on their phone.
📞 Save hundreds of millions in transaction fees with VietQR!
Consult now: 0989 971 131
VietQR API FAQ
[faqs]
#### Which banks does VietQR support?
Over 50 NAPAS member banks (virtually all banks in Vietnam).
#### Is there a transfer amount limit?
It depends on the transfer limit of the customer's bank account (typically 500 million – 1 billion VND/day).
[/faqs]