Get dynamic QR code status
Use this API to query the detailed status of a dynamic QR code you have created, so you can check its payment status in real time.
POST
URLhttps://open-api.tingee.vn/v1/get-status-dynamic-qr
Check the status of a dynamic QR code. The result includes the bill information and related transactions (if any).
Header Request
| Header | Required | Description |
|---|---|---|
Content-Type | ✓ | application/json |
x-client-id | ✓ | Partner identifier issued by TINGEE. |
x-signature | ✓ | HMAC SHA512 authentication signature. See How to generate the signature. |
x-request-timestamp | ✓ | Time the request is sent (format: yyyyMMddHHmmssSSS, UTC+7) |
Body Parameter
| Field | Type | Required | Description |
|---|---|---|---|
merchantId | number | ✕ | Merchant ID (Required if you connect with a Master Merchant account). |
qrAccount | string | ✓ | QR account (data.qrAccount) returned by the Create dynamic QR API. |
billId | string | ✓ | Dynamic QR ID (data.billId) returned by the Create dynamic QR API. |
Code samples
- cURL
- NestJS
- C#
- Java
- PHP
curl --location --request POST 'https://open-api.tingee.vn/v1/get-status-dynamic-qr' \
--header 'accept: application/json' \
--header 'x-client-id: YOUR_CLIENT_ID' \
--header 'x-request-timestamp: 20240509154004003' \
--header 'x-signature: YOUR_SIGNATURE' \
--header 'Content-Type: application/json' \
--data '{
"qrAccount": "V1TQRD7F3A9C1B2E4",
"billId": "V1TQRD7F3A9C1B2E4"
}'
import axios from "axios";
import { createHmac } from "crypto";
const CLIENT_ID = "YOUR_CLIENT_ID";
const SECRET_KEY = "YOUR_SECRET_KEY";
// Timestamp in UTC+7, format yyyyMMddHHmmssSSS
function getTimestamp() {
return new Date(Date.now() + 7 * 60 * 60 * 1000)
.toISOString()
.replace(/[-:TZ.]/g, "")
.slice(0, 17);
}
async function getStatusDynamicQr() {
const body = {
qrAccount: "V1TQRD7F3A9C1B2E4",
billId: "V1TQRD7F3A9C1B2E4",
};
const bodyJson = JSON.stringify(body);
const timestamp = getTimestamp();
const signature = createHmac("sha512", SECRET_KEY)
.update(`${timestamp}:${bodyJson}`)
.digest("hex");
const res = await axios.request({
method: "POST",
url: "https://open-api.tingee.vn/v1/get-status-dynamic-qr",
data: bodyJson,
headers: {
accept: "application/json",
"Content-Type": "application/json",
"x-client-id": CLIENT_ID,
"x-request-timestamp": timestamp,
"x-signature": signature,
},
});
console.log(res.data);
}
getStatusDynamicQr();
using System;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Threading.Tasks;
public class Program
{
private const string ClientId = "YOUR_CLIENT_ID";
private const string SecretKey = "YOUR_SECRET_KEY";
private static readonly HttpClient Client = new HttpClient();
public static async Task Main()
{
var body = new
{
qrAccount = "V1TQRD7F3A9C1B2E4",
billId = "V1TQRD7F3A9C1B2E4"
};
// Do not escape non-ASCII / special characters so the JSON matches TINGEE's JSON.stringify
var jsonOptions = new JsonSerializerOptions { Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping };
var bodyJson = JsonSerializer.Serialize(body, jsonOptions);
// Timestamp in UTC+7, format yyyyMMddHHmmssSSS
var timestamp = DateTime.UtcNow.AddHours(7).ToString("yyyyMMddHHmmssfff");
var signature = HmacSha512(SecretKey, $"{timestamp}:{bodyJson}");
var request = new HttpRequestMessage(HttpMethod.Post, "https://open-api.tingee.vn/v1/get-status-dynamic-qr");
request.Headers.Add("accept", "application/json");
request.Headers.Add("x-client-id", ClientId);
request.Headers.Add("x-request-timestamp", timestamp);
request.Headers.Add("x-signature", signature);
request.Content = new StringContent(bodyJson, Encoding.UTF8, "application/json");
var response = await Client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
private static string HmacSha512(string key, string message)
{
using var hmac = new HMACSHA512(Encoding.UTF8.GetBytes(key));
var hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(message));
return Convert.ToHexString(hash).ToLower();
}
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
public class Main {
private static final String CLIENT_ID = "YOUR_CLIENT_ID";
private static final String SECRET_KEY = "YOUR_SECRET_KEY";
public static void main(String[] args) throws Exception {
// Minified JSON, same as JSON.stringify()
String bodyJson = "{\"qrAccount\":\"V1TQRD7F3A9C1B2E4\",\"billId\":\"V1TQRD7F3A9C1B2E4\"}";
// Timestamp in UTC+7, format yyyyMMddHHmmssSSS
String timestamp = ZonedDateTime.now(ZoneId.of("Asia/Ho_Chi_Minh"))
.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));
String signature = hmacSha512(SECRET_KEY, timestamp + ":" + bodyJson);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://open-api.tingee.vn/v1/get-status-dynamic-qr"))
.header("accept", "application/json")
.header("Content-Type", "application/json")
.header("x-client-id", CLIENT_ID)
.header("x-request-timestamp", timestamp)
.header("x-signature", signature)
.method("POST", HttpRequest.BodyPublishers.ofString(bodyJson, StandardCharsets.UTF_8))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
private static String hmacSha512(String key, String data) throws Exception {
Mac mac = Mac.getInstance("HmacSHA512");
mac.init(new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "HmacSHA512"));
byte[] hash = mac.doFinal(data.getBytes(StandardCharsets.UTF_8));
StringBuilder hex = new StringBuilder();
for (byte b : hash) hex.append(String.format("%02x", b));
return hex.toString();
}
}
<?php
$clientId = "YOUR_CLIENT_ID";
$secretKey = "YOUR_SECRET_KEY";
$body = [
"qrAccount" => "V1TQRD7F3A9C1B2E4",
"billId" => "V1TQRD7F3A9C1B2E4",
];
// Do not escape "/" or non-ASCII characters so the JSON matches TINGEE's JSON.stringify
$bodyJson = json_encode($body, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
// Timestamp in UTC+7, format yyyyMMddHHmmssSSS
$now = new DateTime("now", new DateTimeZone("Asia/Ho_Chi_Minh"));
$timestamp = $now->format("YmdHisv");
$signature = hash_hmac("sha512", $timestamp . ":" . $bodyJson, $secretKey);
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => "https://open-api.tingee.vn/v1/get-status-dynamic-qr",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $bodyJson,
CURLOPT_HTTPHEADER => [
"Accept: application/json",
"Content-Type: application/json",
"x-client-id: " . $clientId,
"x-request-timestamp: " . $timestamp,
"x-signature: " . $signature,
],
]);
$response = curl_exec($ch);
if ($response === false) {
echo "cURL Error: " . curl_error($ch);
} else {
echo $response;
}
curl_close($ch);
Sample Response
{
"code": "00",
"message": "Success",
"data": {
"billInfo": {
"billId": "V1TQRD7F3A9C1B2E4",
"qrCodeType": "dynamic-one-time-payment",
"bankBin": "970418",
"accountNumber": "21510002865945",
"vaAccountNumber": "V1T199988811",
"qrAccount": "V1TQRD7F3A9C1B2E4",
"amount": 500000,
"purpose": "Thanh toan cho hoa don HD2918732312",
"totalAmountPaid": 500000,
"totalPaymentsCount": 1,
"expireInMinute": 43185,
"extraInfo": null,
"status": "fully-paid"
},
"transactionInfos": [
{
"transactionId": "3f1c2a9e-8b4d-4e57-9a61-2c7d5b0e8f14",
"merchantId": 1001,
"shopId": 1024,
"bankBin": "970418",
"cashFlowSource": "bank-transfer",
"code": "FT25283123456",
"amount": 500000,
"type": "credit",
"content": "Thanh toan cho hoa don HD2918732312",
"currency": "VND",
"accountNumber": "21510002865945",
"vaAccountNumber": "V1TQRD7F3A9C1B2E4",
"transactionDate": "20251010103000",
"billId": "V1TQRD7F3A9C1B2E4"
}
]
}
}
| Field | Type | Description |
|---|---|---|
code | string | Result code (00 = Success). |
message | string | Response message. |
data.billInfo | object | Dynamic QR information. |
data.billInfo.billId | string | Dynamic QR ID. |
data.billInfo.qrCodeType | string | QR type: dynamic-one-time-payment or dynamic-recurring-payment. |
data.billInfo.bankBin | string | Bank BIN. |
data.billInfo.accountNumber | string | Source account number that receives the money. |
data.billInfo.vaAccountNumber | string | Virtual account (VA) number used to create the dynamic QR. |
data.billInfo.qrAccount | string | QR account encoded in the dynamic QR. |
data.billInfo.amount | number | Amount to pay. |
data.billInfo.purpose | string | Payment description. |
data.billInfo.totalAmountPaid | number | Total amount paid for this QR. |
data.billInfo.totalPaymentsCount | number | Number of payments recorded for this QR. |
data.billInfo.expireInMinute | number | Difference in minutes between the QR's expiry time and the query time (absolute value); null if the QR has no expiry. |
data.billInfo.extraInfo | string | Additional information passed when creating the QR (null if none). |
data.billInfo.status | string | Dynamic QR status: - active: Active, not yet paid.- partially-paid: Partially paid (total paid is less than amount).- fully-paid: Fully paid.- expired: Expired.- cancelled: Cancelled. |
data.transactionInfos | array | List of transactions paid for this QR; null if there are no transactions yet. Each item has the same structure as data.items[] of the Transaction history API. |
data.transactionInfos[].transactionId | string | Transaction ID in the TINGEE system (UUID). |
data.transactionInfos[].amount | number | Transaction amount. |
data.transactionInfos[].code | string | Transaction code on the bank side. |
data.transactionInfos[].content | string | Transfer description. |
data.transactionInfos[].transactionDate | string | Transaction time (format: yyyyMMddHHmmss, UTC+7). |
Common error codes
| Code | Description | How to handle |
|---|---|---|
1076 | Dynamic QR not found | Check the billId and qrAccount from the Create dynamic QR result. |
1095, 1096 | Master Merchant merchantId error | Pass the merchantId of a sub-Merchant that belongs to the Master Merchant calling the API. |
90, 91, 92, 97 | Request authentication error (timestamp, client-id, signature) | See System error codes. |
Others | Other errors | See Error codes. |