Create Conversion
curl --request POST \
--url https://api-sandbox.uqpaytech.com/api/v1/conversion \
--header 'Content-Type: application/json' \
--header 'x-auth-token: <api-key>' \
--header 'x-idempotency-key: <x-idempotency-key>' \
--data '
{
"quote_id": "784832f7-1f8a-4b08-ac2a-8719b5b2a590",
"sell_currency": "USD",
"buy_currency": "SGD",
"conversion_date": "2024-08-26",
"sell_amount": "1000.00",
"buy_amount": "1000.00"
}
'import requests
url = "https://api-sandbox.uqpaytech.com/api/v1/conversion"
payload = {
"quote_id": "784832f7-1f8a-4b08-ac2a-8719b5b2a590",
"sell_currency": "USD",
"buy_currency": "SGD",
"conversion_date": "2024-08-26",
"sell_amount": "1000.00",
"buy_amount": "1000.00"
}
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({
quote_id: '784832f7-1f8a-4b08-ac2a-8719b5b2a590',
sell_currency: 'USD',
buy_currency: 'SGD',
conversion_date: '2024-08-26',
sell_amount: '1000.00',
buy_amount: '1000.00'
})
};
fetch('https://api-sandbox.uqpaytech.com/api/v1/conversion', 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/conversion",
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([
'quote_id' => '784832f7-1f8a-4b08-ac2a-8719b5b2a590',
'sell_currency' => 'USD',
'buy_currency' => 'SGD',
'conversion_date' => '2024-08-26',
'sell_amount' => '1000.00',
'buy_amount' => '1000.00'
]),
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/conversion"
payload := strings.NewReader("{\n \"quote_id\": \"784832f7-1f8a-4b08-ac2a-8719b5b2a590\",\n \"sell_currency\": \"USD\",\n \"buy_currency\": \"SGD\",\n \"conversion_date\": \"2024-08-26\",\n \"sell_amount\": \"1000.00\",\n \"buy_amount\": \"1000.00\"\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/conversion")
.header("x-idempotency-key", "<x-idempotency-key>")
.header("x-auth-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"quote_id\": \"784832f7-1f8a-4b08-ac2a-8719b5b2a590\",\n \"sell_currency\": \"USD\",\n \"buy_currency\": \"SGD\",\n \"conversion_date\": \"2024-08-26\",\n \"sell_amount\": \"1000.00\",\n \"buy_amount\": \"1000.00\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.uqpaytech.com/api/v1/conversion")
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 \"quote_id\": \"784832f7-1f8a-4b08-ac2a-8719b5b2a590\",\n \"sell_currency\": \"USD\",\n \"buy_currency\": \"SGD\",\n \"conversion_date\": \"2024-08-26\",\n \"sell_amount\": \"1000.00\",\n \"buy_amount\": \"1000.00\"\n}"
response = http.request(request)
puts response.read_body{
"conversion_id": "784832f7-1f8a-4b08-ac2a-8719b5b2a590",
"short_reference_id": "P220406-LLCVLRM",
"sell_currency": "USD",
"sell_amount": "10",
"buy_currency": "SGD",
"buy_amount": "7.36",
"created_date": "2024-08-22T17:12:58+08:00",
"currency_pair": "USDSGD",
"reference": "XC240822-TXCRW2EI",
"status": "AWAITING_FUNDS"
}Conversion
Create Conversion
在你的 UQPAY 账户余额内创建一笔新的换汇。这允许你以可用汇率将一种币种兑换为另一种币种。
使用说明
- 如果使用预生成的报价,请提供有效的
quote_id。关键的换汇参数(buy_currency、sell_currency、conversion_date)必须与报价详情一致。 - 同时指定
buy_currency和sell_currency,但buy_amount与sell_amount只定义其中之一。所定义的金额代表交易(固定)的一方,另一方金额将根据 UQPAY 的汇率自动计算。
POST
/
v1
/
conversion
Create Conversion
curl --request POST \
--url https://api-sandbox.uqpaytech.com/api/v1/conversion \
--header 'Content-Type: application/json' \
--header 'x-auth-token: <api-key>' \
--header 'x-idempotency-key: <x-idempotency-key>' \
--data '
{
"quote_id": "784832f7-1f8a-4b08-ac2a-8719b5b2a590",
"sell_currency": "USD",
"buy_currency": "SGD",
"conversion_date": "2024-08-26",
"sell_amount": "1000.00",
"buy_amount": "1000.00"
}
'import requests
url = "https://api-sandbox.uqpaytech.com/api/v1/conversion"
payload = {
"quote_id": "784832f7-1f8a-4b08-ac2a-8719b5b2a590",
"sell_currency": "USD",
"buy_currency": "SGD",
"conversion_date": "2024-08-26",
"sell_amount": "1000.00",
"buy_amount": "1000.00"
}
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({
quote_id: '784832f7-1f8a-4b08-ac2a-8719b5b2a590',
sell_currency: 'USD',
buy_currency: 'SGD',
conversion_date: '2024-08-26',
sell_amount: '1000.00',
buy_amount: '1000.00'
})
};
fetch('https://api-sandbox.uqpaytech.com/api/v1/conversion', 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/conversion",
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([
'quote_id' => '784832f7-1f8a-4b08-ac2a-8719b5b2a590',
'sell_currency' => 'USD',
'buy_currency' => 'SGD',
'conversion_date' => '2024-08-26',
'sell_amount' => '1000.00',
'buy_amount' => '1000.00'
]),
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/conversion"
payload := strings.NewReader("{\n \"quote_id\": \"784832f7-1f8a-4b08-ac2a-8719b5b2a590\",\n \"sell_currency\": \"USD\",\n \"buy_currency\": \"SGD\",\n \"conversion_date\": \"2024-08-26\",\n \"sell_amount\": \"1000.00\",\n \"buy_amount\": \"1000.00\"\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/conversion")
.header("x-idempotency-key", "<x-idempotency-key>")
.header("x-auth-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"quote_id\": \"784832f7-1f8a-4b08-ac2a-8719b5b2a590\",\n \"sell_currency\": \"USD\",\n \"buy_currency\": \"SGD\",\n \"conversion_date\": \"2024-08-26\",\n \"sell_amount\": \"1000.00\",\n \"buy_amount\": \"1000.00\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.uqpaytech.com/api/v1/conversion")
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 \"quote_id\": \"784832f7-1f8a-4b08-ac2a-8719b5b2a590\",\n \"sell_currency\": \"USD\",\n \"buy_currency\": \"SGD\",\n \"conversion_date\": \"2024-08-26\",\n \"sell_amount\": \"1000.00\",\n \"buy_amount\": \"1000.00\"\n}"
response = http.request(request)
puts response.read_body{
"conversion_id": "784832f7-1f8a-4b08-ac2a-8719b5b2a590",
"short_reference_id": "P220406-LLCVLRM",
"sell_currency": "USD",
"sell_amount": "10",
"buy_currency": "SGD",
"buy_amount": "7.36",
"created_date": "2024-08-22T17:12:58+08:00",
"currency_pair": "USDSGD",
"reference": "XC240822-TXCRW2EI",
"status": "AWAITING_FUNDS"
}授权
由 UQPAY 提供的登录 API Token。
请求头
用于保持操作幂等性的唯一标识符(UUID),确保同一操作的重复执行不会产生意外影响或重复。它有助于在网络错误、重试或失败时保持数据一致性。
请求体
application/json
报价的唯一 UUID 标识符。
示例:
"784832f7-1f8a-4b08-ac2a-8719b5b2a590"
指定将执行换汇的日期。该日期必须是有效的可换汇日期。
仅支持当前日历日期 —— 不允许过去或未来的日期。
格式:YYYY-MM-DD。
示例:
"2024-08-26"
换汇中卖出币种的金额。
示例:
"1000.00"
换汇中买入币种的金额。
示例:
"1000.00"
响应
200 - application/json
OK —— 成功获取 payout。
换汇交易的唯一 UUID 标识符。
示例:
"784832f7-1f8a-4b08-ac2a-8719b5b2a590"
系统生成的用于标识该实体的编号。
示例:
"P220406-LLCVLRM"
换汇中卖出币种的金额。
示例:
"10"
换汇中买入币种的金额。
示例:
"7.36"
换汇交易发起时的时间戳。
示例:
"2024-08-22T17:12:58+08:00"
该报价对应的货币对。货币对的方向尽可能遵循市场惯例。
示例:
"USDSGD"
系统生成的用于标识该实体的编号。
示例:
"XC240822-TXCRW2EI"
该换汇交易的当前状态。有效值为:
PROCESSING:换汇请求正在由系统处理中。AWAITING_FUNDS:系统正在等待源资金到位。TRADE_SETTLED:已按约定汇率执行换汇。FUNDS_ARRIVED:已收到兑换后的目标币种资金。
示例:
"AWAITING_FUNDS"

