VietQR

An article about the payment method which allows to process payments in Vietnamese dongs by using bank accounts in Vietnam and supports purchases and refunds.

Overview

Introduction

VietQR is a payment method which allows you to process payments in Vietnamese dongs by using bank accounts in Vietnam. VietQR was developed by National Payment Corporation of Vietnam (NAPAS) in collaboration with the Vietnam Banks Association and is widely used in the country. This method supports purchases and refunds.

When making a purchase using the VietQR method, the customer scans the merchant's QR code via their banking application and transfers funds to the merchant directly from their bank account. A refund by using the VietQR method is also performed directly to the customer's bank account that was used for the purchase. This use case, along with the method's status, contributes to customer trust and the active use of the method.

This article provides information about working with the VietQR method: general insights are presented in the Overview section, while information about the actions required to process payments and perform other actions is presented in the sections that follow.

General information

Payment method type QR code payments
Payment instruments bank accounts
Countries and regions VN
Payment currencies VND
Currency conversion on the Ecommpay side
One-time purchases +
Credential-on-file purchases
Full refunds +
Partial refunds
Payouts
Chargebacks
Notes
  • the amounts for VND currency are specified in the smallest currency unit
  • the expiration time of the QR code on the platform side is 20 minutes by default, it can be changed by contacting your Ecommpay account manager
  • processing of refunds is available by contacting Ecommpay technical support (more details below)
Onboarding and access fee refer to your Ecommpay account manager

Processing of refunds

To perform refunds via the VietQR method, you need to contact Ecommpay technical support and provide the following information:

  • Identifier of the original purchase (payment_id) in the Ecommpay payment platform.
  • Number of the customer's bank account used for debiting funds during the initial purchase.
  • Full name of the holder of the specified bank account (as registered in the bank).
  • Current name of the bank servicing the specified account.

Based on the provided information, Ecommpay technical support specialists check the possibility of refunding funds to the customer, initiate the refund on the provider's side, and provide the merchant's specialists with information about its result. If additional information is required to perform the refund, it is also requested from the merchant's specialists. If the refund is performed on the provider's side, the refund operation is registered and processed, and a callback about its processing (informing about the success status) is sent to the web service. If the refund is declined on the provider's or bank's side, the refund operation is not registered in the platform, and information about the refund decline is sent to the merchant's specialists directly by Ecommpay technical support specialists.

The base time for performing a refund using this workflow is one business day.

Interaction diagram

Payment processing by using the VietQR method involves the merchant's web service, one of Ecommpay interfaces, the Ecommpay payment platform, and technical facilities of the provider service.



Operations support

Various platform interfaces can be used to process payments and perform operations using the VietQR method. Purchases can be processed by using Payment Page and Gate. At the same time, regardless of the interfaces used, amount limitations are applicable depending on the bank used for purchase processing.

Processing scenarios

To perform a purchase by using the VietQR method, you need to display the payment instructions and QR code to the customer.

Purchases by using Payment Page

General information

To process a purchase through Payment Page by using the VietQR method, the merchant's web service is required to send a request with all required parameters and signature to the Ecommpay URL and receive a callback with the result. The full sequence and special aspects of purchase processing are provided below.



Figure 3. Purchase processing by using Payment Page: step-by-step description
  1. A customer initiates a purchase in the web service.
  2. The web service sends the request for opening Payment Page to the specified Ecommpay URL.
  3. The request for opening Payment Page is sent to the payment platform.
  4. The payment platform receives the request and validates the required parameters and signature.
  5. Payment Page is generated based on the project and request parameters.
  6. Payment Page is displayed to the customer.
  7. The customer selects the VietQR method.
  8. The request for processing the payment by using the VietQR method is received by the payment platform.
  9. The payment platform processes the request and sends it to the provider service.
  10. The request is processed on the side of the provider service.
  11. The data for displaying the payment instructions to the customer is sent from the provider service to the payment platform.
  12. The data for displaying the payment instructions is sent from the payment platform to Payment Page.
  13. The payment instructions are displayed to the customer.
  14. The customer completes all required payment steps.
  15. The purchase is processed in the provider service.
  16. The provider service sends a notification about the result to the payment platform.
  17. The payment platform sends the payment result callback to the web service.
  18. The payment platform sends the result information to Payment Page.
  19. The result information is displayed to the customer on Payment Page.

Information about the formats of requests and callbacks used for processing payments by using the VietQR method via Payment Page is presented further in this section; general information about working with the Payment Page API is presented in Interaction concepts.

Request format

There are several things you need to consider when sending purchase requests by using the VietQR method:

  1. The following parameters required for any payment must be specified:
    • project_id—project identifier obtained from Ecommpay during integration
    • payment_id—payment identifier unique within the project
    • payment_currency—payment currency code in the ISO-4217 alpha-3 format
    • payment_amount—payment amount in the smallest currency unit
    • customer_id—customer identifier unique within the project
  2. The following parameters required for any payment must be specified: project_id, payment_id, payment_currency, payment_amount, customer_id.
  3. If you need to have the payment form displayed with the VietQR method selected, set the force_payment_method parameter to vietqr.
  4. Additionally, any other parameters available for working with Payment Page can be used (details).
  5. After all target parameters are specified, generate a signature (details).

Thus, a correct request for opening the payment form using the VietQR method must contain the project identifier, basic payment information (identifier, amount, and currency code), customer identifier and signature, as well as possible additional parameters.

{
   "project_id": 120,
   "payment_id": "580",
   "payment_amount": 1000,
   "payment_currency": "VND",
   "customer_id": "customer1",
   "signature": "kUi2x9dKHAVNU0FYldOcZzUCwX6R\/ekpZhkIQg=="
}
Figure 4. Example of sufficient data in a purchase request
{
   "project_id": 120,
   "payment_id": "580",
   "payment_amount": 1000,
   "payment_currency": "VND",
   "customer_id": "customer1",
   "signature": "kUi2x9dKHAVNU0FYldOcZzUCwX6R\/ekpZhkIQg=="
}

Callback format

The VietQR method uses the standard format for callbacks to deliver purchase results. For more information, see Handling callbacks (details).

The following is the example of a callback with information about a ... purchase made by the 300,000 VND customer in the 1234 project.

Figure 5. Example of callback data indicating that the purchase has been processed
{
    "project_id": 1234,
    "payment": {
        "id": "payment_47",
        "type": "purchase",
        "status": "success",
        "date": "2022-03-25T11:08:45+0000",
        "method": "VietQR",
        "sum": {
            "amount": 300000,
            "currency": "VND"
        },
        "description": ""
    },
    "customer": {
        "id": "customer_123"
    },
    "operation": {
        "id": 28,
        "type": "sale",
        "status": "success",
        "date": "2022-03-25T11:08:45+0000",
        "created_date": "2022-03-25T11:08:05+0000",
        "request_id": "9e32835fb27907e042b5cf60a4e17839",
        "sum_initial": {
            "amount": 300000,
            "currency": "VND"
        },
        "sum_converted": {
            "amount": 300000,
            "currency": "VND"
        },
        "code": "0",
        "message": "Success",
        "provider": {
            "id": 12345,
            "payment_id": "123abc123-321",
            "auth_code": ""
        }
    },
    "signature": "U7HQO7ToISZhMPkUKQtoYzFvoB3cs9CRd4xeYG2Q=="
}

The following is the example of a callback with information about a declined purchase.

Figure 6. Example of callback data indicating that the purchase has been declined
{
    "project_id": 1234,
    "payment": {
        "id": "payment_47",
        "type": "purchase",
        "status": "decline",
        "date": "2022-03-25T11:20:30+0000",
        "method": "VietQR",
        "sum": {
            "amount": 300000,
            "currency": "VND"
        },
        "description": ""
    },
    "customer": {
        "id": "customer_123"
    },
    "operation": {
        "id": 31,
        "type": "sale",
        "status": "decline",
        "date": "2022-03-25T11:20:30+0000",
        "created_date": "2022-03-25T11:19:53+0000",
        "request_id": "fff3d5f8d5d31bc460b68b57dc63f4b482e906eb",
        "sum_initial": {
            "amount": 300000,
            "currency": "VND"
        },
        "sum_converted": {
            "amount": 300000,
            "currency": "VND"
        },
        "code": "20000",
        "message": "General decline",
        "provider": {
            "id": 15923,
            "payment_id": "0cf4215c-8978",
            "auth_code": ""
        }
    },
    "signature": "J7W15rkqrLzTC4z2iFYv58P4VnHANu445/jmY+g=="
}

Useful links

The following articles can be useful when implementing purchases via Payment Page:

Purchases by using Gate

General information

To process a purchase through Gate by using the VietQR method, the merchant's web service is required to do the following:

  1. Send a request with all the required parameters and signature to the Ecommpay URL.
  2. Receive an intermediate callback from the payment platform and display the payment instructions and QR code to the customer.
  3. Receive the final callback from the payment platform.

The full sequence and special aspects of purchase processing are provided below.



Figure 7. Purchase processing by using Gate: step-by-step description
  1. A customer initiates a purchase by using the VietQR method in the web service.
  2. The web service sends the request for processing the purchase by using Gate to the specified Ecommpay URL.
  3. The payment platform receives the request.
  4. The payment platform validates the required parameters and signature in the request.
  5. The payment platform sends the response to the web service with information about the receipt of the request and its validity (details).
  6. The payment platform performs further processing of the request (with parameter consistency check) and sends it to the provider service.
  7. The request is processed on the side of the provider service.
  8. The data for displaying the payment instructions to the customer is sent from the provider service to the payment platform.
  9. The data for displaying the payment instructions is sent from the payment platform to the web service.
  10. The payment instructions are displayed to the customer.
  11. The customer completes all required payment steps.
  12. The purchase is processed in the provider service.
  13. The provider service sends the payment result notification to the payment platform.
  14. The payment platform sends the payment result callback to the web service.
  15. The customer receives the payment result information from the web service.

Information about the formats of requests and callbacks used for processing payments by using the VietQR method via Gate is presented further in this section. General information about working with the Gate API is presented in Interaction concepts.

Request format

There are several things you need to consider when sending purchase requests by using the VietQR method:

  1. To initiate each purchase, send a separate POST request to the /v2/payment/vietqr/sale endpoint.
  2. Each request must include the following objects and parameters:
    • Object general—general purchase information:
      • project_id—project identifier obtained from Ecommpay during integration
      • payment_id—payment identifier unique within the project
      • signature—request signature generated after all required parameters are specified (details—in the Signature generation and verification) (details)
    • Object payment—payment information:
      • amount—payment amount in the smallest currency unit
      • currency—payment currency code in the ISO-4217 alpha-3 format
    • Object customer—customer information:
      • id—customer identifier unique within the project
      • ip_address—customer IP address relevant for the initiated payment
  3. Additionally, any other parameters included in the specification can be used.

Thus, a correct purchase request by using the VietQR method must contain the project identifier, basic payment information (identifier, amount, and currency code), customer identifier and IP address, signature, as well as possible additional parameters.

{
  "general": {
    "project_id": 210,
    "payment_id": "test_payment",
    "signature": "PJkV8ej\/UG0Di8hTng6JvipTv+AWoXW\/9MTO8yJA=="
  },
  "payment": {
    "amount": 1000,
    "currency": "VND"
  },
  "customer": {
    "id": "customer123",
    "ip_address": "192.0.2.0"
  }
}
Figure 8. Example of sufficient data in a purchase request
{
  "general": {
    "project_id": 210,
    "payment_id": "test_payment",
    "signature": "PJkV8ej\/UG0Di8hTng6JvipTv+AWoXW\/9MTO8yJA=="
  },
  "payment": {
    "amount": 1000,
    "currency": "VND"
  },
  "customer": {
    "id": "customer123",
    "ip_address": "192.0.2.0"
  }
}

Formats of intermediate callbacks for displaying payment instructions

Each payment made with the VietQR method requires displaying payment instructions to customers. To display payment instructions it is necessary to receive an intermediate callback from the payment platform and use the information included in the display_data array. The format of such callbacks is standard (details).

The following objects and parameters are included in the display_data array:

  • type—type of data (the value is always qr_data)
  • title—the name of the transferred data that needs to be displayed to the customer (the value is always QR code)
  • data—a string based on which a QR code should be generated on the web service side (according to ISO/IEC 18004:2015)
Figure 9. display_data example
"display_data": [
            {
                "type": "qr_data",
                "title": "QR code",
                "data": "00020101000005800113C6616TTAE11"
            }
        ]

Final callback format

The VietQR method uses the standard format for callbacks to deliver purchase results. For more information, see Handling callbacks (details).

The following is the example of a callback with information about a 300,000 VND purchase made in the 1234 project.

Figure 10. Example of callback data indicating that the purchase has been processed
{
    "project_id": 1234,
    "payment": {
        "id": "payment_47",
        "type": "purchase",
        "status": "success",
        "date": "2022-03-25T11:08:45+0000",
        "method": "VietQR",
        "sum": {
            "amount": 300000,
            "currency": "VND"
        },
        "description": ""
    },
    "customer": {
        "id": "customer_123"
    },
    "operation": {
        "id": 28,
        "type": "sale",
        "status": "success",
        "date": "2022-03-25T11:08:45+0000",
        "created_date": "2022-03-25T11:08:05+0000",
        "request_id": "9e32835fb27907e042b5cf60a4e17839",
        "sum_initial": {
            "amount": 300000,
            "currency": "VND"
        },
        "sum_converted": {
            "amount": 300000,
            "currency": "VND"
        },
        "code": "0",
        "message": "Success",
        "provider": {
            "id": 12345,
            "payment_id": "123abc123-321",
            "auth_code": ""
        }
    },
    "signature": "U7HQO7ToISZhMPkUKQtoYzFvoB3cs9CRd4xeYG2Q=="
}

The following is the example of a callback with information about a declined purchase.

Figure 11. Example of callback data indicating that the purchase has been declined
{
    "project_id": 1234,
    "payment": {
        "id": "payment_47",
        "type": "purchase",
        "status": "decline",
        "date": "2022-03-25T11:20:30+0000",
        "method": "VietQR",
        "sum": {
            "amount": 300000,
            "currency": "VND"
        },
        "description": ""
    },
    "customer": {
        "id": "customer_123"
    },
    "operation": {
        "id": 31,
        "type": "sale",
        "status": "decline",
        "date": "2022-03-25T11:20:30+0000",
        "created_date": "2022-03-25T11:19:53+0000",
        "request_id": "fff3d5f8d5d31bc460b68b57dc63f4b482e906eb",
        "sum_initial": {
            "amount": 300000,
            "currency": "VND"
        },
        "sum_converted": {
            "amount": 300000,
            "currency": "VND"
        },
        "code": "20000",
        "message": "General decline",
        "provider": {
            "id": 15923,
            "payment_id": "0cf4215c-8978",
            "auth_code": ""
        }
    },
    "signature": "J7W15rkqrLzTC4z2iFYv58P4VnHANu445/jmY+g=="
}

Useful links

The following articles can be useful when implementing purchases via Gate:

Analysis of payments results

To analyse information about payments made with the VietQR method and other methods, you can use:

  • Dashboard interface toolkit with various lists and analytic panels.
  • Reports in CSV file format, available via the Reports section (one-time and periodically).
  • Data in JSON format, sent by program requests to a specified URL available by using the Data API interface.

If you have any questions, refer to the documentation (Dashboard and Using Data API) and Ecommpay technical support.