1️Gọi API Get Token
API get token sử dụng để lấy bearer token, token này sử dụng cho kích hoạt cho ecommerce
POST
POST
https://<vietqr-host>/<basepath>/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 được VietQR cung cấp để truy cập các API VietQR.
token_type
String
Là dạng token dạng “Bearer”.
expires_in
String
Thời gian hết hạn của token. Mặc định là 300 giây.
Response
{
"access_token": "bearer_token_của_đối_tác",
"token_type": "Bearer",
"expires_in": 300
}
Code mẫu
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