Create Virtual Account
curl --request POST \
--url https://api-sandbox.uqpaytech.com/api/v1/virtual/accounts \
--header 'Content-Type: application/json' \
--header 'x-auth-token: <api-key>' \
--header 'x-idempotency-key: <x-idempotency-key>' \
--data '
{
"currency": "USD,SGD",
"payment_method": "LOCAL"
}
'import requests
url = "https://api-sandbox.uqpaytech.com/api/v1/virtual/accounts"
payload = {
"currency": "USD,SGD",
"payment_method": "LOCAL"
}
headers = {
"x-idempotency-key": "<x-idempotency-key>",
"x-auth-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-idempotency-key': '<x-idempotency-key>',
'x-auth-token': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({currency: 'USD,SGD', payment_method: 'LOCAL'})
};
fetch('https://api-sandbox.uqpaytech.com/api/v1/virtual/accounts', 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/virtual/accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'currency' => 'USD,SGD',
'payment_method' => 'LOCAL'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-auth-token: <api-key>",
"x-idempotency-key: <x-idempotency-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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.uqpaytech.com/api/v1/virtual/accounts"
payload := strings.NewReader("{\n \"currency\": \"USD,SGD\",\n \"payment_method\": \"LOCAL\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-idempotency-key", "<x-idempotency-key>")
req.Header.Add("x-auth-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
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/virtual/accounts")
.header("x-idempotency-key", "<x-idempotency-key>")
.header("x-auth-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"currency\": \"USD,SGD\",\n \"payment_method\": \"LOCAL\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.uqpaytech.com/api/v1/virtual/accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-idempotency-key"] = '<x-idempotency-key>'
request["x-auth-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"currency\": \"USD,SGD\",\n \"payment_method\": \"LOCAL\"\n}"
response = http.request(request)
puts response.read_body{
"message": "SUCCESS"
}Virtual Accounts
Create Virtual Account
虚拟账户是充当本地银行账户的外币账户,可用于在全球范围内收款。你将获得账户信息,从而能够从各类平台收款。全球收款账户也可用于为 UQPAY 余额充值。
关于账户创建行为的说明
目前,无论虚拟账户(VA)是否实际创建成功,请求成功的 API 响应都将始终返回 SUCCESS 状态。
VA 的实际状态可通过 Webhooks 跟踪:
virtual.account.create:表示已为指定币种发起创建 VA 的请求。virtual.account.update且status = Active:表示 VA 已成功创建,现可使用。
虚拟账户创建失败时不会发送任何 webhook。
POST
/
v1
/
virtual
/
accounts
Create Virtual Account
curl --request POST \
--url https://api-sandbox.uqpaytech.com/api/v1/virtual/accounts \
--header 'Content-Type: application/json' \
--header 'x-auth-token: <api-key>' \
--header 'x-idempotency-key: <x-idempotency-key>' \
--data '
{
"currency": "USD,SGD",
"payment_method": "LOCAL"
}
'import requests
url = "https://api-sandbox.uqpaytech.com/api/v1/virtual/accounts"
payload = {
"currency": "USD,SGD",
"payment_method": "LOCAL"
}
headers = {
"x-idempotency-key": "<x-idempotency-key>",
"x-auth-token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-idempotency-key': '<x-idempotency-key>',
'x-auth-token': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({currency: 'USD,SGD', payment_method: 'LOCAL'})
};
fetch('https://api-sandbox.uqpaytech.com/api/v1/virtual/accounts', 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/virtual/accounts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'currency' => 'USD,SGD',
'payment_method' => 'LOCAL'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-auth-token: <api-key>",
"x-idempotency-key: <x-idempotency-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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.uqpaytech.com/api/v1/virtual/accounts"
payload := strings.NewReader("{\n \"currency\": \"USD,SGD\",\n \"payment_method\": \"LOCAL\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-idempotency-key", "<x-idempotency-key>")
req.Header.Add("x-auth-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
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/virtual/accounts")
.header("x-idempotency-key", "<x-idempotency-key>")
.header("x-auth-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"currency\": \"USD,SGD\",\n \"payment_method\": \"LOCAL\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.uqpaytech.com/api/v1/virtual/accounts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-idempotency-key"] = '<x-idempotency-key>'
request["x-auth-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"currency\": \"USD,SGD\",\n \"payment_method\": \"LOCAL\"\n}"
response = http.request(request)
puts response.read_body{
"message": "SUCCESS"
}授权
由 UQPay 提供的登录 API Token。
请求头
用于保持操作幂等性的唯一标识符(UUID),确保同一操作的重复执行不会产生意外影响或重复。它有助于在网络错误、重试或失败时保持数据一致性。
请求的自定义标识符,最多 64 个字符。如果提供,该值将在关联的 webhook 事件中以 request_id 返回。
Maximum string length:
64请求体
application/json
响应
200 - application/json
VA 账户创建成功。
示例:
"SUCCESS"
⌘I

