3️⃣Gọi API Get Token
Sử dụng thông tin kết nối do VietQR cung cấp để lấy token phục vụ cho việc truy cập API của VietQR
POST-
Môi trường Dev (Test/Kiểm thử)
POST-
Môi trường Dev (Test/Kiểm thử)https://dev.vietqr.org/vqr/api/token_generate
POST-
Môi trường Production (Golive/Vận hành)
POST-
Môi trường Production (Golive/Vận hành)https://api.vietqr.org/vqr/api/token_generate
Headers
Name
Value
Content-Type
application/json
Authorization
Basic Authentication: Base64[username:password
]
Body
Name
Type
Description
access_token
String
Là Bearer Token do VietQR cung cấp dùng để truy cập các API của VietQR
token_type
String
Là dạng token dạng “Bearer”.
expires_in
Integer
Thời gian hết hạn của token. Mặc định là 300 giây.
Response
{
"access_token": "bearer_token_của_VietQR_cung_cấp",
"token_type": "Bearer",
"expires_in": 300
}
Note:
Đối với môi trường Sandbox Username và Password do VietQR cung cấp khi đăng ký tích hợp và kết nối thành công (hình ảnh minh họa)


Code tham khảo
curl --location --request POST 'https://dev.vietqr.org/vqr/api/token_generate' \
--header 'Authorization: Basic Y3VzdG9tZXItdmlldHFydGVzdC11c2VyMjQ2ODpZM1Z6ZEc5dFpYSXRkbWxsZEhGeWRHVnpkQzExYzJWeU1qUTJPQT09'
Response:
{
"access_token": "eyJhbGciOiJIUzUxMiJ9.eyJhdXRob3JpdGllcyI6WyJST0xFX1VTRVIiXSwidXNlciI6IlkzVnpkRzl0WlhJdGRtbGxkSEZ5ZEdWemRDMTFjMlZ5TWpRMk9BPT0iLCJpYXQiOjE3MjEzNzI2MzQsImV4cCI6MTcyMTM3MjkzNH0.D19qvrpYHUgcGjDCXuXXAv3j6lZr6tfmIB0VzdCzAXMJAElGok04sNLysS6PRLdRb0hSgEX5_9KpLjB-xErn-A",
"token_type": "Bearer",
"expires_in": 300
}
Các câu hỏi thường gặp
Last updated