PageSourceSearch

https://developers.tingee.vn/assets/js/b2e23896.71a3292d.js

js tingee.vn collected 2026-09-25 20:24:44 UTC 24,125 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkapi_docs=globalThis.webpackChunkapi_docs||[]).push([[15602],{54532:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>x,contentTitle:()=>o,default:()=>y,frontMatter:()=>a,metadata:()=>s,toc:()=>g});const s=JSON.parse('{"id":"tingee-box/generate-and-show-dynamic-qr-code","title":"T\u1ea1o QR v\xe0 \u0111\u1ed3ng th\u1eddi hi\u1ec3n th\u1ecb","description":"API n\xe0y cho ph\xe9p t\u1ea1o m\xe3 QR \u0111\u1ed9ng v\xe0 hi\u1ec3n th\u1ecb tr\u1ef1c ti\u1ebfp l\xean m\xe0n h\xecnh thi\u1ebft b\u1ecb TINGEEBOX m\xe0 kh\xf4ng c\u1ea7n ph\u1ea3i g\u1ecdi API hi\u1ec3n th\u1ecb QR.","source":"@site/versioned_docs/version-1.2.0/tingee-box/generate-and-show-dynamic-qr-code.mdx","sourceDirName":"tingee-box","slug":"/tingee-box/generate-and-show-dynamic-qr-code","permalink":"/docs/tingee-box/generate-and-show-dynamic-qr-code","draft":false,"unlisted":false,"tags":[],"version":"1.2.0","frontMatter":{"id":"generate-and-show-dynamic-qr-code","title":"T\u1ea1o QR v\xe0 \u0111\u1ed3ng th\u1eddi hi\u1ec3n th\u1ecb","sidebar_label":"T\u1ea1o QR v\xe0 \u0111\u1ed3ng th\u1eddi hi\u1ec3n th\u1ecb"},"sidebar":"bankLinkSidebar","previous":{"title":"Hi\u1ec3n th\u1ecb QR Code","permalink":"/docs/tingee-box/show-qr-code"},"next":{"title":"Th\xeam thi\u1ebft b\u1ecb v\xe0o c\u1eeda h\xe0ng","permalink":"/docs/tingee-box/add-device-to-shop"}}');var i=n(74848),r=n(28453),l=n(14085),d=n(65726),c=n(49489),h=n(7227);const a={id:"generate-and-show-dynamic-qr-code",title:"T\u1ea1o QR v\xe0 \u0111\u1ed3ng th\u1eddi hi\u1ec3n th\u1ecb",sidebar_label:"T\u1ea1o QR v\xe0 \u0111\u1ed3ng th\u1eddi hi\u1ec3n th\u1ecb"},o="T\u1ea1o QR \u0111\u1ed9ng v\xe0 \u0111\u1ed3ng th\u1eddi hi\u1ec3n th\u1ecb l\xean loa",x={},g=[{value:"Header Request",id:"header-request",level:3},{value:"Body Parameter",id:"body-parameter",level:3},{value:"V\xed d\u1ee5 m\xe3 ngu\u1ed3n",id:"v\xed-d\u1ee5-m\xe3-ngu\u1ed3n",level:3},{value:"Response m\u1eabu",id:"response-m\u1eabu",level:3},{value:"M\xe3 l\u1ed7i th\u01b0\u1eddng g\u1eb7p",id:"m\xe3-l\u1ed7i-th\u01b0\u1eddng-g\u1eb7p",level:2}];function j(e){const t={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",hr:"hr",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",...(0,r.R)(),...e.components},{No:n,Ok:s}=t;return n||m("No",!0),s||m("Ok",!0),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.header,{children:(0,i.jsx)(t.h1,{id:"t\u1ea1o-qr-\u0111\u1ed9ng-v\xe0-\u0111\u1ed3ng-th\u1eddi-hi\u1ec3n-th\u1ecb-l\xean-loa",children:"T\u1ea1o QR \u0111\u1ed9ng v\xe0 \u0111\u1ed3ng th\u1eddi hi\u1ec3n th\u1ecb l\xean loa"})}),"\n",(0,i.jsx)(t.p,{children:"API n\xe0y cho ph\xe9p t\u1ea1o m\xe3 QR \u0111\u1ed9ng v\xe0 hi\u1ec3n th\u1ecb tr\u1ef1c ti\u1ebfp l\xean m\xe0n h\xecnh thi\u1ebft b\u1ecb TINGEEBOX m\xe0 kh\xf4ng c\u1ea7n ph\u1ea3i g\u1ecdi API hi\u1ec3n th\u1ecb QR."}),"\n",(0,i.jsx)(t.admonition,{type:"note",children:(0,i.jsxs)(t.p,{children:["API n\xe0y ch\u1ec9 \xe1p d\u1ee5ng cho c\xe1c thi\u1ebft b\u1ecb ",(0,i.jsx)(t.strong,{children:"kh\xf4ng ph\u1ea3i TingeeBox 3LS"}),"."]})}),"\n",(0,i.jsxs)(l.A,{method:"POST",uatUrl:"https://uat-open-api.tingee.vn/v1/device/generate-and-show-dynamic-qr-code",prodUrl:"https://open-api.tingee.vn/v1/device/generate-and-show-dynamic-qr-code",description:"T\u1ea1o QR Code \u0111\u1ed9ng v\xe0 hi\u1ec3n th\u1ecb ngay l\xean thi\u1ebft b\u1ecb TINGEEBOX \u0111\u1ec3 kh\xe1ch h\xe0ng qu\xe9t thanh to\xe1n.",children:[(0,i.jsx)(t.h3,{id:"header-request",children:"Header Request"}),(0,i.jsxs)(t.table,{children:[(0,i.jsx)(t.thead,{children:(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.th,{style:{textAlign:"left"},children:"Header"}),(0,i.jsx)(t.th,{style:{textAlign:"center"},children:"B\u1eaft bu\u1ed9c"}),(0,i.jsx)(t.th,{style:{textAlign:"left"},children:"M\xf4 t\u1ea3"})]})}),(0,i.jsxs)(t.tbody,{children:[(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"Content-Type"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(s,{})}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"application/json"})})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"x-client-id"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(s,{})}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"M\xe3 \u0111\u1ecbnh danh c\u1ee7a \u0111\u1ed1i t\xe1c do TINGEE cung c\u1ea5p."})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"x-signature"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(s,{})}),(0,i.jsxs)(t.td,{style:{textAlign:"left"},children:["Ch\u1eef k\xfd x\xe1c th\u1ef1c HMAC SHA512. Xem th\xeam t\u1ea1i ",(0,i.jsx)(t.a,{href:"/docs/config-info#sinh-ch%E1%BB%AF-k%C3%BD-signature",children:"C\xe1ch sinh ch\u1eef k\xfd"}),"."]})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"x-request-timestamp"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(s,{})}),(0,i.jsxs)(t.td,{style:{textAlign:"left"},children:["Th\u1eddi gian g\u1eedi request (format: ",(0,i.jsx)(t.code,{children:"yyyyMMddHHmmssSSS"}),", m\xfai gi\u1edd UTC+7)"]})]})]})]}),(0,i.jsx)(t.h3,{id:"body-parameter",children:"Body Parameter"}),(0,i.jsxs)(t.table,{children:[(0,i.jsx)(t.thead,{children:(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.th,{style:{textAlign:"left"},children:"Tr\u01b0\u1eddng"}),(0,i.jsx)(t.th,{style:{textAlign:"center"},children:"Ki\u1ec3u"}),(0,i.jsx)(t.th,{style:{textAlign:"center"},children:"B\u1eaft bu\u1ed9c"}),(0,i.jsx)(t.th,{style:{textAlign:"left"},children:"M\xf4 t\u1ea3"})]})}),(0,i.jsxs)(t.tbody,{children:[(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"merchantId"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"number"}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(n,{})}),(0,i.jsxs)(t.td,{style:{textAlign:"left"},children:["ID c\u1ee7a Merchant ",(0,i.jsx)("br",{}),"(B\u1eaft bu\u1ed9c n\u1ebfu k\u1ebft n\u1ed1i b\u1eb1ng t\xe0i kho\u1ea3n Master Merchant)."]})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"uuid"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"string"}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(s,{})}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"M\xe3 thi\u1ebft b\u1ecb."})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"qrCodeType"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"string"}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(s,{})}),(0,i.jsxs)(t.td,{style:{textAlign:"left"},children:["Lo\u1ea1i QR \u0111\u1ed9ng:",(0,i.jsx)("br",{}),"- ",(0,i.jsx)(t.code,{children:"dynamic-one-time-payment"}),": QR thanh to\xe1n duy nh\u1ea5t 1 l\u1ea7n.",(0,i.jsx)("br",{}),"- ",(0,i.jsx)(t.code,{children:"dynamic-recurring-payment"}),": QR thanh to\xe1n nhi\u1ec1u l\u1ea7n."]})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"vaAccountNumber"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"string"}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(s,{})}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"S\u1ed1 t\xe0i kho\u1ea3n \u1ea3o."})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"amount"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"number"}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(s,{})}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"Gi\xe1 tr\u1ecb h\xf3a \u0111\u01a1n."})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"purpose"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"string"}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(n,{})}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"N\u1ed9i dung thanh to\xe1n."})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"bankBin"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"string"}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(s,{})}),(0,i.jsxs)(t.td,{style:{textAlign:"left"},children:["M\xe3 BIN ng\xe2n h\xe0ng. Xem t\u1ea1i ",(0,i.jsx)(t.a,{href:"/docs/banking/get-banks",children:"Danh s\xe1ch ng\xe2n h\xe0ng h\u1ed7 tr\u1ee3"}),"."]})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"expireInMinute"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"number"}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(n,{})}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"Th\u1eddi gian hi\u1ec7u l\u1ef1c c\u1ee7a QR (ph\xfat). M\u1eb7c \u0111\u1ecbnh l\xe0 30 ng\xe0y."})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"extraInfo"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"string"}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(n,{})}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"Th\xf4ng tin th\xeam khi t\u1ea1o QR (\u0110\u1ed1i t\xe1c c\xf3 th\u1ec3 truy\u1ec1n m\xe3 Bill...)."})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"firstText"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"string"}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(n,{})}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"N\u1ed9i dung hi\u1ec3n th\u1ecb k\xe8m QR (d\xf2ng 1)."})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"secondText"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"string"}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(n,{})}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"N\u1ed9i dung hi\u1ec3n th\u1ecb k\xe8m QR (d\xf2ng 2)."})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"thirdText"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"string"}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(n,{})}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"N\u1ed9i dung hi\u1ec3n th\u1ecb k\xe8m QR (d\xf2ng 3)."})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"showTime"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"number"}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(n,{})}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"Th\u1eddi gian hi\u1ec3n th\u1ecb QR tr\xean loa (gi\xe2y). M\u1eb7c \u0111\u1ecbnh l\xe0 15 gi\xe2y."})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"playSound"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"boolean"}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(n,{})}),(0,i.jsxs)(t.td,{style:{textAlign:"left"},children:["Ph\xe1t ti\u1ebfng k\xeau khi hi\u1ec3n th\u1ecb QR.",(0,i.jsx)("br",{}),"- ",(0,i.jsx)(t.code,{children:"true"}),": C\xf3 k\xe8m ti\u1ebfng k\xeau.",(0,i.jsx)("br",{}),"- ",(0,i.jsx)(t.code,{children:"false"}),"/kh\xf4ng truy\u1ec1n: Kh\xf4ng k\xe8m ti\u1ebfng k\xeau."]})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"readAmountAfterPay"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"boolean"}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:(0,i.jsx)(n,{})}),(0,i.jsxs)(t.td,{style:{textAlign:"left"},children:["\u0110\u1ecdc s\u1ed1 ti\u1ec1n sau thanh to\xe1n th\xe0nh c\xf4ng.",(0,i.jsx)("br",{}),"- ",(0,i.jsx)(t.code,{children:"true"}),": T\u1ef1 \u0111\u1ed9ng \u0111\u1ecdc s\u1ed1 ti\u1ec1n qua Loa.",(0,i.jsx)("br",{}),"- ",(0,i.jsx)(t.code,{children:"false"}),"/kh\xf4ng truy\u1ec1n: \u0110\u1ed1i t\xe1c g\u1ecdi API \u0111\u1ecdc s\u1ed1 ti\u1ec1n \u0111\u1ec3 ph\xe1t qua Loa."]})]})]})]}),(0,i.jsx)(t.h3,{id:"v\xed-d\u1ee5-m\xe3-ngu\u1ed3n",children:"V\xed d\u1ee5 m\xe3 ngu\u
11ed3n"}),(0,i.jsxs)(c.A,{children:[(0,i.jsx)(h.A,{value:"curl",label:"cURL",children:(0,i.jsx)(d.A,{language:"bash",children:'curl --location --request POST \'https://open-api.tingee.vn/v1/device/generate-and-show-dynamic-qr-code\' \\\n--header \'accept: application/json\' \\\n--header \'x-signature: YOUR_SIGNATURE\' \\\n--header \'x-request-timestamp: 20251110175110111\' \\\n--header \'x-client-id: YOUR_CLIENT_ID\' \\\n--header \'Content-Type: application/json\' \\\n--data \'{\n"uuid": "DEVICE_UUID",\n"qrCodeType": "dynamic-one-time-payment",\n"vaAccountNumber": "V1T123456789",\n"amount": 150000,\n"purpose": "Thanh toan don hang #001",\n"bankName": "970422",\n"expireInMinute": 5,\n"firstText": "Quan ABC",\n"showTime": 30,\n"playSound": true,\n"readAmountAfterPay": true\n}\'\n'})}),(0,i.jsx)(h.A,{value:"nestjs",label:"NestJS",children:(0,i.jsx)(d.A,{language:"ts",children:'import axios from "axios";\nimport { createHmac } from "crypto";\nimport { format } from \'date-fns\';\n\nasync function generateAndShowQR() {\nconst body = {\n  uuid: "DEVICE_UUID",\n  qrCodeType: "dynamic-one-time-payment",\n  vaAccountNumber: "V1T123456789",\n  amount: 150000,\n  purpose: "Thanh toan don hang #001",\n  bankName: "970422",\n  expireInMinute: 5,\n  firstText: "Quan ABC",\n  showTime: 30,\n  playSound: true,\n  readAmountAfterPay: true,\n};\n\nconst timestamp = format(new Date(), "yyyyMMddHHmmssSSS");\nconst secretKey = "YOUR_SECRET_KEY";\nconst message = `${timestamp}:${JSON.stringify(body)}`;\nconst signature = createHmac(\'sha512\', secretKey).update(message).digest(\'hex\');\n\nconst res = await axios.post(\n  "https://open-api.tingee.vn/v1/device/generate-and-show-dynamic-qr-code",\n  body,\n  {\n    headers: {\n      "x-client-id": "YOUR_CLIENT_ID",\n      "x-request-timestamp": timestamp,\n      "x-signature": signature,\n      "Content-Type": "application/json",\n    },\n  }\n);\n\nconsole.log(res.data);\n}\n'})}),(0,i.jsx)(h.A,{value:"csharp",label:"C#",children:(0,i.jsx)(d.A,{language:"csharp",children:'using System;\nusing System.Net.Http;\nusing System.Text;\nusing System.Text.Json;\nusing System.Security.Cryptography;\nusing System.Threading.Tasks;\n\npublic class GenerateAndShowQRExample\n{\n  private static readonly HttpClient client = new HttpClient();\n\n  public static async Task Main()\n  {\n      var body = new {\n          uuid = "DEVICE_UUID",\n          qrCodeType = "dynamic-one-time-payment",\n          vaAccountNumber = "V1T123456789",\n          amount = 150000,\n          purpose = "Thanh toan don hang #001",\n          bankName = "970422",\n          expireInMinute = 5,\n          firstText = "Quan ABC",\n          showTime = 30,\n          playSound = true,\n          readAmountAfterPay = true\n      };\n\n      var timestamp = DateTime.Now.ToString("yyyyMMddHHmmssfff");\n      var secretKey = "YOUR_SECRET_KEY";\n      var bodyJson = JsonSerializer.Serialize(body);\n      var message = $"{timestamp}:{bodyJson}";\n      var signature = CreateHmacSha512(secretKey, message);\n\n      var request = new HttpRequestMessage(HttpMethod.Post, "https://open-api.tingee.vn/v1/device/generate-and-show-dynamic-qr-code");\n      request.Headers.Add("x-signature", signature);\n      request.Headers.Add("x-request-timestamp", timestamp);\n      request.Headers.Add("x-client-id", "YOUR_CLIENT_ID");\n      request.Content = new StringContent(bodyJson, Encoding.UTF8, "application/json");\n\n      var response = await client.SendAsync(request);\n      string result = await response.Content.ReadAsStringAsync();\n      Console.WriteLine(result);\n  }\n\n  private static string CreateHmacSha512(string key, string message)\n  {\n      using var hmac = new HMACSHA512(Encoding.UTF8.GetBytes(key));\n      var hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(message));\n      return BitConverter.ToString(hash).Replace("-", "").ToLower();\n  }\n}\n'})}),(0,i.jsx)(h.A,{value:"java",label:"Java",children:(0,i.jsx)(d.A,{language:"java",children:'import java.net.http.*;\nimport java.net.URI;\nimport java.nio.charset.StandardCharsets;\nimport javax.crypto.Mac;\nimport javax.crypto.spec.SecretKeySpec;\nimport java.time.LocalDateTime;
1\nimport java.time.format.DateTimeFormatter;\n\npublic class GenerateAndShowQR {\npublic static void main(String[] args) throws Exception {\n  String bodyJson = "{"uuid":"DEVICE_UUID","qrCodeType":"dynamic-one-time-payment","vaAccountNumber":"V1T123456789","amount":150000,"bankName":"970422","showTime":30,"playSound":true,"readAmountAfterPay":true}";\n  String secretKey = "YOUR_SECRET_KEY";\n  String timestamp = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));\n\n  String message = timestamp + ":" + bodyJson;\n  String signature = hmacSha512(secretKey, message);\n\n  HttpClient client = HttpClient.newHttpClient();\n  HttpRequest request = HttpRequest.newBuilder()\n      .uri(URI.create("https://open-api.tingee.vn/v1/device/generate-and-show-dynamic-qr-code"))\n      .header("accept", "application/json")\n      .header("x-signature", signature)\n      .header("x-request-timestamp", timestamp)\n      .header("x-client-id", "YOUR_CLIENT_ID")\n      .header("Content-Type", "application/json")\n      .POST(HttpRequest.BodyPublishers.ofString(bodyJson))\n      .build();\n\n  HttpResponse<String>
1 response = client.send(request, HttpResponse.BodyHandlers.ofString());\n  System.out.println(response.body());\n}\n\nprivate static String hmacSha512(String key, String data) throws Exception {\n    Mac mac = Mac.getInstance("HmacSHA512");\n    SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), "HmacSHA512");\n    mac.init(secretKeySpec);\n    byte[] hash = mac.doFinal(data.getBytes(StandardCharsets.UTF_8));\n    return toHex(hash);\n}\n\nprivate static String toHex(byte[] bytes) {\n    StringBuilder hex = new StringBuilder(bytes.length * 2);\n    for (byte b : bytes) {\n        hex.append(String.format("%02x", b));\n    }\n    return hex.toString();\n}\n}\n'})}),(0,i.jsx)(h.A,{value:"php",label:"PHP",children:(0,i.jsx)(d.A,{language:"php",children:"function generateAndShowQR() {\n  $body = [\n      'uuid' => 'DEVICE_UUID',\n      'qrCodeType' => 'dynamic-one-time-payment',\n      'vaAccountNumber' => 'V1T123456789',\n      'amount' => 150000,\n      'purpose' => 'Thanh toan don hang #001',\n      'bankName' => '970422',\n      'expireInMinute' => 5,\n      'firstText' => 'Quan ABC',\n      'showTime' => 30,\n      'playSound' => true,\n      'readAmountAfterPay' => true,\n  ];\n\n  $jsonBody = json_encode($body);\n  $timestamp = date(\"YmdHis\") . substr((string)microtime(true), -3);\n  $secretKey = \"YOUR_SECRET_KEY\";\n\n  $message = $timestamp . \":\" . $jsonBody;\n  $signature = hash_hmac(\"sha512\", $message, $secretKey);\n\n  $ch = curl_init();\n  curl_setopt_array($ch, [\n      CURLOPT_URL => \"https://open-api.tingee.vn/v1/device/generate-and-show-dynamic-qr-code\",\n      CURLOPT_RETURNTRANSFER => true,\n      CURLOPT_POST => true,\n      CURLOPT_POSTFIELDS => $jsonBody,\n      CURLOPT_HTTPHEADER => [\n          \"Accept: application/json\",\n          \"Content-Type: application/json\",\n          \"x-client-id: YOUR_CLIENT_ID\",\n          \"x-request-timestamp: \" . $timestamp,\n          \"x-signature: \" . $signature\n      ]\n  ]);\n\n  $response = curl_exec($ch);\n  $err = curl_error($ch);\n  curl_close($ch);\n\n  if ($err) {\n      echo \"cURL Error: \" . $err;\n  } else {\n      echo $response;\n  }\n}\n"})})]}),(0,i.jsx)(t.h3,{id:"response-m\u1eabu",children:"Response m\u1eabu"}),(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-json",children:'{\n  "code": "00",\n  "message": "Success",\n  "data": {\n    "qrCode": "00020101021238570010A...",\n    "qrAccount": "V1T123456789",\n    "billId": "BILL_20251110_001"\n  }\n}\n'})}),(0,i.jsxs)(t.table,{children:[(0,i.jsx)(t.thead,{children:(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.th,{style:{textAlign:"left"},children:"Tr\u01b0\u1eddng"}),(0,i.jsx)(t.th,{style:{textAlign:"center"},children:"Ki\u1ec3u"}),(0,i.jsx)(t.th,{style:{textAlign:"left"},children:"M\xf4 t\u1ea3"})]})}),(0,i.jsxs)(t.tbody,{children:[(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"code"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"string"}),(0,i.jsxs)(t.td,{style:{textAlign:"left"},children:["M\xe3 k\u1ebft qu\u1ea3 (",(0,i.jsx)(t.code,{children:"00"})," = Th\xe0nh c\xf4ng)."]})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"message"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"string"}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"Th\xf4ng \u0111i\u1ec7p ph\u1ea3n h\u1ed3i."})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"data.qrCode"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"string"}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"Chu\u1ed7i QR Code \u0111\u1ed9ng \u0111\u1ec3 hi\u1ec3n th\u1ecb / qu\xe9t."})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"data.qrAccount"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"string"}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"S\u1ed1 t\xe0i kho\u1ea3n \u1ea3o g\u1eafn v\u1edbi QR."})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"data.billId"})}),(0,i.jsx)(t.td,{style:{textAlign:"center"},children:"string"}),(0,i.jsx)(t.td,{style:{textAlign:"left"}
1,children:"M\xe3 h\xf3a \u0111\u01a1n t\u01b0\u01a1ng \u1ee9ng."})]})]})]})]}),"\n",(0,i.jsx)(t.hr,{}),"\n",(0,i.jsx)(t.h2,{id:"m\xe3-l\u1ed7i-th\u01b0\u1eddng-g\u1eb7p",children:"M\xe3 l\u1ed7i th\u01b0\u1eddng g\u1eb7p"}),"\n",(0,i.jsxs)(t.table,{children:[(0,i.jsx)(t.thead,{children:(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.th,{style:{textAlign:"left"},children:"Code"}),(0,i.jsx)(t.th,{style:{textAlign:"left"},children:"M\xf4 t\u1ea3"}),(0,i.jsx)(t.th,{style:{textAlign:"left"},children:"H\u01b0\u1edbng x\u1eed l\xfd"})]})}),(0,i.jsxs)(t.tbody,{children:[(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"90"})}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"Sai format timestamp"}),(0,i.jsxs)(t.td,{style:{textAlign:"left"},children:["Ki\u1ec3m tra format ",(0,i.jsx)(t.code,{children:"yyyyMMddHHmmssSSS"}),"."]})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"91"})}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"Request qu\xe1 h\u1ea1n"}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"Ki\u1ec3m tra th\u1eddi gian g\u1eedi request."})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"97"})}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"Sai ch\u1eef k\xfd"}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"Ki\u1ec3m tra l\u1ea1i Secret Key v\xe0 logic t\u1ea1o Signature."})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{style:{textAlign:"left"},children:(0,i.jsx)(t.code,{children:"Others"})}),(0,i.jsx)(t.td,{style:{textAlign:"left"},children:"L\u1ed7i kh\xe1c"}),(0,i.jsxs)(t.td,{style:{textAlign:"left"},children:["Xem ",(0,i.jsx)(t.a,{href:"/docs/error-list",children:"Danh s\xe1ch m\xe3 l\u1ed7i"}),"."]})]})]})]})]})}function y(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(j,{...e})}):j(e)}function m(e,t){throw new Error("Expected "+(t?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.