Access Token
curl --request POST \
--url https://api-sandbox.uqpaytech.com/api/v1/connect/token \
--header 'x-api-key: <api-key>' \
--header 'x-client-id: <api-key>'import requests
url = "https://api-sandbox.uqpaytech.com/api/v1/connect/token"
headers = {
"x-api-key": "<api-key>",
"x-client-id": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'x-client-id': '<api-key>'}
};
fetch('https://api-sandbox.uqpaytech.com/api/v1/connect/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-sandbox.uqpaytech.com/api/v1/connect/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>",
"x-client-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.uqpaytech.com/api/v1/connect/token"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-client-id", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-sandbox.uqpaytech.com/api/v1/connect/token")
.header("x-api-key", "<api-key>")
.header("x-client-id", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.uqpaytech.com/api/v1/connect/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["x-client-id"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"auth_token": "2YotnFZFEjr1zCsicMWpAA2YotnFZFEjr1zCsicMWpAA2YotnFZFEjr1zCsicMWpAA2YotnFZFEjr1zCsicMWpAA",
"expired_at": 1757449854
}Authentication
Access Token
在 HTTP 请求头中指定你的 x-client-id 和 x-api-key 以请求 Access Token。返回的 auth_token 是所有其他 API 端点都必需的,必须通过 x-auth-token 请求头传递,并以 Bearer 为前缀——例如 x-auth-token: Bearer <YOUR_TOKEN_HERE>。所有业务线都要求带上 Bearer 前缀。
在 Token 过期或按下述业务线规则失效之前,你可以重复使用它。请通过 expired_at 确定 Token 的过期时间。
auth_token 在生产环境中的有效期为 30 分钟。
各业务线的 Token 并发规则
对于同一个 x-client-id,以下规则适用于生产环境和 Sandbox:
- 多个 Token 可同时有效——Account Center、Global Account、Card Issuance、Stablecoin Account。签发新 Token 不会使先前尚未过期的 Token 失效。
- 仅接受最新签发的 Token——Global Acquiring。签发新 Token 会使先前的 Token 失效,即使尚未到达其
expired_at指定的过期时间。
对于 Global Acquiring,请协调 Token 的签发,并在进程之间共享最新 Token。避免多个进程各自独立签发 Token,否则签发新 Token 后,使用旧 Token 的请求会因身份验证失败而被拒绝。
POST
/
v1
/
connect
/
token
Access Token
curl --request POST \
--url https://api-sandbox.uqpaytech.com/api/v1/connect/token \
--header 'x-api-key: <api-key>' \
--header 'x-client-id: <api-key>'import requests
url = "https://api-sandbox.uqpaytech.com/api/v1/connect/token"
headers = {
"x-api-key": "<api-key>",
"x-client-id": "<api-key>"
}
response = requests.post(url, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'x-client-id': '<api-key>'}
};
fetch('https://api-sandbox.uqpaytech.com/api/v1/connect/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-sandbox.uqpaytech.com/api/v1/connect/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>",
"x-client-id: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.uqpaytech.com/api/v1/connect/token"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("x-client-id", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-sandbox.uqpaytech.com/api/v1/connect/token")
.header("x-api-key", "<api-key>")
.header("x-client-id", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.uqpaytech.com/api/v1/connect/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["x-client-id"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"auth_token": "2YotnFZFEjr1zCsicMWpAA2YotnFZFEjr1zCsicMWpAA2YotnFZFEjr1zCsicMWpAA2YotnFZFEjr1zCsicMWpAA",
"expired_at": 1757449854
}
