1️Call the Check Transaction API

This API is used to verify information about transactions that have been completed.

POST

https://<vietqr-host>/<basepath>/api/transactions/check-order

Headers

NameValue

Content-Type

application/json

Authorization

Bearer <token>

Body

NameTypeRequiredDescription

bankAccount

String

Yes

The bank account generating the VietQR payment code.

type

String

Yes

Check by orderId: 0 Check by referenceNumber: 1

value

String

Yes

+ The value is orderId if type = 0

+ The value is referenceNumber if type = 1

checkSum

String

Yes

The MD5 hash should be created from the combination of: bankAccount + username

Response

[
    {
        "referenceNumber": "transaction_code",
        "orderId": "order_id",
        "amount": "transaction_amount",
        "content": "payment_content",
        "transType": "incoming_or_outgoing_transaction",
        "status": "transaction_status_as_number",
        "type": "transaction_type_as_number",
        "timeCreated": "QR_code_creation_timestamp",
        "timePaid": "payment_timestamp",
        "terminalCode": "terminal_code",
        "note": "transaction_note",
        "refundCount": "number_of_refunds_for_this_transaction",
        "amountRefunded": "amount_refunded_for_this_transaction"
    }
]

Returned Value for type

  • 0: Transaction from dynamic VietQR code.

  • 1: Transaction from static VietQR code.

  • 2: Transaction outside the VietQR system.

  • 3: Transaction from semi-dynamic VietQR code.

  • 6: Refund transaction.

Returned Value for status

  • 0: Transaction pending payment.

  • 1: Transaction has been paid.

  • 2: Transaction payment has expired.


Sample

curl --location 'https://api.vietqr.org/vqr/api/transactions/check-order' \
--header 'Cookie: JSESSIONID=5CAD2D74C5EBDF9B1CAC5684F2DB47CE; JSESSIONID=C1711954475F66AE09967ADFFA4C80CD; JSESSIONID=F40E5CBDEEB02F82DF40BAD476A6222B' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJhdXRob3JpdGllcyI6WyJST0xFX1VTRVIiXSwidXNlciI6IlkzVnpkRzl0WlhJdGJtZDFlV1Z1TFhWelpYSXlORGt5IiwiaWF0IjoxNzIxMzc2MzQ2LCJleHAiOjE3MjEzNzY2NDZ9.QfnN8-p79uB8w5rTRmuOBoANrku276Jtzd7osltE9-E1zQfiXo0YlGCiX1cOHe4A0_VRWJPC5s0tymhND2kGnQ' \
--data '{
    "bankAccount": "the_bank_account",
    "type": "transaction_check_type: 0: order_id, 1: reference_number",
    "value": "value_to_check",
    "checkSum": "MD5 HASH 128 bit of: bankAccount + username"
}'

FAQs

What is the Check Transaction API used for?

The Check Transaction API is used to verify the status of a specific transaction before performing subsequent operations, such as refunds.

What is checkSum and why is it important?

checkSum is a 128-bit MD5 hash of the bankAccount and username values, ensuring the integrity and security of the request. It helps to authenticate that the data has not been altered during transmission.

If the Check Transaction API returns a status of "FAILED", what does that mean?

A "FAILED" status may indicate that the transaction code or order ID is invalid, or the transaction has been canceled. You should verify the input information or contact support.

How to handle common errors when using the Check Transaction API?

Common errors include:

  • Incorrect input information (bankAccount, value, or checkSum is inaccurate).

  • Expired or invalid token.

  • Connection failure. Ensure that you have thoroughly checked all information and the token before calling the API.

Can I check the status of any transaction using this API?

You can only check the status of transactions that have been processed through the VietQR system, and you must provide accurate information corresponding to the transaction code or order ID.

Last updated