# VietQR

> Accept VND bank transfers in Vietnam with the Direct API, display the payment QR code, and confirm the result on your server.

## Basic information

The customer scans the payment QR code with a supported banking app and authorizes the transfer.

- Integration path: [Direct API](/payments/versions/v2/online-payments/api)
- Transaction type: One-time payment
- `lpmsInfo.lpmsType`: `VIET_QR`

| Customer country/region | Order currency |
| --- | --- |
| 🇻🇳 VN | VND |

The customer country/region is the `billingInformation.country` value in the payment request.

This guide applies to enabled merchants and applications.

## Before you begin

Complete [Setup](/payments/versions/v2/get-started/setup) and confirm VietQR enablement, VND orders, transaction limits, payment expiry, and testing arrangements with Onerway. The customer needs a banking app that supports VietQR; see [NAPAS VietQR](https://developer.napas.com.vn/vi/product/introduce/viet-qr-pay) for the service description.

Prepare actual customer and product information according to the Direct API requirements, including the customer’s email, billing country `VN`, and required shipping details. Submit `billingInformation`, `shippingInformation`, `lpmsInfo`, and `txnOrderMsg` as JSON strings. Configure notification and return URLs, and map your order to the Onerway payment identifiers. Follow [Currency and amount validation](/payments/versions/v2/get-started/currency-and-amount) for VND amounts.

## Create the payment and display the QR code

1. On your server, call [Create Direct Transaction](/payments/versions/v2/api-reference/endpoints/direct-create-transaction) with `productType=LPMS`, `subProductType=DIRECT`, `txnType=SALE`, `paymentMode=WEB`, and `orderCurrency=VND`. Set `lpmsType=VIET_QR` in `lpmsInfo`. Include the `ApiKey` header as described in [Request authentication](/payments/versions/v2/get-started/authentication).
2. Select the request example “VietQR request (illustrative)”. Replace the order, customer, product, application, and notification details, follow the current field requirements, and send the `ApiKey` header. The example illustrates the request structure; its amount is not a transaction limit.
3. Select the response example “VietQR response (illustrative)”. Store `paymentId` and `transactionId`. When `status=R` and `actionType=QrCode`, select a supported entry from `codeForm.codeDetails`: for `codeValueType=QRCODE` and `displayType=TEXT`, generate a QR code from `codeValue`; for `displayType=IMAGE`, display the image at the returned `codeValue` URL. `codeForm` is already a JSON object; do not parse it as a JSON string. The number and order of entries are not fixed.
4. When the response also includes `redirectUrl`, you can send the customer to that Onerway-hosted QR display page. The action remains `QrCode`. If `codeForm.expireTime` is returned, use it to handle code expiry; do not assume a fixed lifetime.

The API Reference linked above contains the fields and examples. See [Direct API integration](/payments/versions/v2/online-payments/api) for shared request authentication and response handling.

## Customer actions and final result

The customer scans the QR code with a supported banking app, checks the recipient, amount, and VND currency, and authorizes the transfer. Plan how customers will access the QR code with the devices they use, and test that flow before launch. Your application does not collect banking passwords or verification codes.

Displaying a code, completing an action in the banking app, or returning to your website does not replace a server-confirmed payment result. Process the signature-verified [Payment Result notification](/payments/versions/v2/api-reference/webhooks/payment-result) on your server. If it is missing or you need to check the result, call [Query payments](/payments/versions/v2/api-reference/endpoints/query-payments) with the saved `paymentId`. Fulfil the order after confirming payment success. See [Webhooks](/payments/versions/v2/get-started/webhooks) for verification, acknowledgement, idempotency, and query fallback.

If the customer cancels, leaves payment incomplete, or the code expires, check the existing payment before creating a replacement to avoid duplicate collection.

## Refunds and disputes

Confirm your account’s refund capabilities, partial-refund support, request deadlines, and dispute process with Onerway. If refunds are enabled, follow [Refunds](/payments/versions/v2/online-payments/scenarios/refunds) and track the refund result separately.

## Testing and go-live

Follow [Sandbox testing](/payments/versions/v2/get-started/testing) using the environment and banking procedure agreed with Onerway.

1. Create a VND order and check `VIET_QR`, customer details, and the `ApiKey` header. Verify the returned identifiers and `QrCode` action.
2. Test each code representation your application supports, the returned hosted display link, and expiry when provided. Scan the code, check the amount, and complete the agreed bank authorization.
3. Retain the notification and acknowledgement for the same order, then query the payment and compare the results. Test incomplete payment, cancellation, expiry, duplicate notifications, and early returns.
4. Before launch, confirm production enablement, VND amount rules, notification and return URLs, limits, and expiry. Test refunds separately if enabled.
