连接
更新连接
部分更新连接。仅应用您发送的字段;密钥信息保持掩码处理。
PATCH
/
connections
/
{connection_id}
更新连接
curl --request PATCH \
--url https://api-sandbox.y.uno/v1/connections/{connection_id} \
--header 'Content-Type: application/json' \
--header 'PRIVATE-SECRET-KEY: <api-key>' \
--header 'PUBLIC-API-KEY: <api-key>' \
--data '
{
"account_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"merchant_connection_id": "stripe-us-prod-002",
"params": [
{
"param_id": "SECRET_KEY",
"value": "sk_live_..."
}
],
"costs": [
{
"sort_number": 1,
"cost_name": "Transaction Fee",
"currency": "USD",
"cost_values": {
"successful": {
"fixed_fee": 0.25,
"percentage": 2.7
},
"unsuccessful": {
"fixed_fee": 0,
"percentage": 0
}
}
}
]
}
'import requests
url = "https://api-sandbox.y.uno/v1/connections/{connection_id}"
payload = {
"account_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"merchant_connection_id": "stripe-us-prod-002",
"params": [
{
"param_id": "SECRET_KEY",
"value": "sk_live_..."
}
],
"costs": [
{
"sort_number": 1,
"cost_name": "Transaction Fee",
"currency": "USD",
"cost_values": {
"successful": {
"fixed_fee": 0.25,
"percentage": 2.7
},
"unsuccessful": {
"fixed_fee": 0,
"percentage": 0
}
}
}
]
}
headers = {
"PUBLIC-API-KEY": "<api-key>",
"PRIVATE-SECRET-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'PUBLIC-API-KEY': '<api-key>',
'PRIVATE-SECRET-KEY': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
account_id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
merchant_connection_id: 'stripe-us-prod-002',
params: [{param_id: 'SECRET_KEY', value: 'sk_live_...'}],
costs: [
{
sort_number: 1,
cost_name: 'Transaction Fee',
currency: 'USD',
cost_values: {
successful: {fixed_fee: 0.25, percentage: 2.7},
unsuccessful: {fixed_fee: 0, percentage: 0}
}
}
]
})
};
fetch('https://api-sandbox.y.uno/v1/connections/{connection_id}', 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.y.uno/v1/connections/{connection_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'account_id' => 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
'merchant_connection_id' => 'stripe-us-prod-002',
'params' => [
[
'param_id' => 'SECRET_KEY',
'value' => 'sk_live_...'
]
],
'costs' => [
[
'sort_number' => 1,
'cost_name' => 'Transaction Fee',
'currency' => 'USD',
'cost_values' => [
'successful' => [
'fixed_fee' => 0.25,
'percentage' => 2.7
],
'unsuccessful' => [
'fixed_fee' => 0,
'percentage' => 0
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"PRIVATE-SECRET-KEY: <api-key>",
"PUBLIC-API-KEY: <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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.y.uno/v1/connections/{connection_id}"
payload := strings.NewReader("{\n \"account_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"merchant_connection_id\": \"stripe-us-prod-002\",\n \"params\": [\n {\n \"param_id\": \"SECRET_KEY\",\n \"value\": \"sk_live_...\"\n }\n ],\n \"costs\": [\n {\n \"sort_number\": 1,\n \"cost_name\": \"Transaction Fee\",\n \"currency\": \"USD\",\n \"cost_values\": {\n \"successful\": {\n \"fixed_fee\": 0.25,\n \"percentage\": 2.7\n },\n \"unsuccessful\": {\n \"fixed_fee\": 0,\n \"percentage\": 0\n }\n }\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("PUBLIC-API-KEY", "<api-key>")
req.Header.Add("PRIVATE-SECRET-KEY", "<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.patch("https://api-sandbox.y.uno/v1/connections/{connection_id}")
.header("PUBLIC-API-KEY", "<api-key>")
.header("PRIVATE-SECRET-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"merchant_connection_id\": \"stripe-us-prod-002\",\n \"params\": [\n {\n \"param_id\": \"SECRET_KEY\",\n \"value\": \"sk_live_...\"\n }\n ],\n \"costs\": [\n {\n \"sort_number\": 1,\n \"cost_name\": \"Transaction Fee\",\n \"currency\": \"USD\",\n \"cost_values\": {\n \"successful\": {\n \"fixed_fee\": 0.25,\n \"percentage\": 2.7\n },\n \"unsuccessful\": {\n \"fixed_fee\": 0,\n \"percentage\": 0\n }\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/connections/{connection_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["PUBLIC-API-KEY"] = '<api-key>'
request["PRIVATE-SECRET-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"merchant_connection_id\": \"stripe-us-prod-002\",\n \"params\": [\n {\n \"param_id\": \"SECRET_KEY\",\n \"value\": \"sk_live_...\"\n }\n ],\n \"costs\": [\n {\n \"sort_number\": 1,\n \"cost_name\": \"Transaction Fee\",\n \"currency\": \"USD\",\n \"cost_values\": {\n \"successful\": {\n \"fixed_fee\": 0.25,\n \"percentage\": 2.7\n },\n \"unsuccessful\": {\n \"fixed_fee\": 0,\n \"percentage\": 0\n }\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"connection_id": "f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e",
"merchant_connection_id": "stripe-us-prod-002",
"provider_id": "STRIPE",
"status": "ACTIVE",
"flow_type": "PAYIN",
"payment_methods": [
"CARD"
],
"params": [
{
"param_id": "SECRET_KEY",
"value": "***"
}
],
"costs": [
{
"sort_number": 1,
"cost_name": "Transaction Fee",
"currency": "USD"
}
],
"created_at": "2026-05-12T10:24:00Z",
"updated_at": "2026-05-12T11:02:17Z"
}{
"type": "validation_error",
"code": "UNKNOWN_PARAM",
"message": "Param 'FOO' is not part of provider 'STRIPE' catalog"
}{
"type": "auth_error",
"code": "NOT_AUTHENTICATED",
"message": "Not authenticated"
}{
"type": "not_found",
"code": "CONNECTION_NOT_FOUND",
"message": "Connection '...' was not found"
}{
"type": "conflict",
"code": "CONNECTION_MERCHANT_ID_CONFLICT",
"message": "A connection with merchant_connection_id 'stripe-us-prod-002' already exists in this account"
}部分更新您之前创建的连接。仅应用请求体中出现的字段:您省略的任何字段都保留其当前值。
此处无法更改的内容:
provider_id、flow_type、payment_methods 和 INTEGRATION_TYPE 参数不可变更。如需更改其中任何一项,请创建新连接,并将您的路由规则重新指向该连接。路径参数
创建连接 返回的 id。必须属于您的 API 密钥所作用的账户。
请求体
要更改的参数,以
{param_id, value} 对组成的 扁平数组 提交,结构与 创建连接 相同。参数会 按 param_id 合并 到连接的当前参数上:您未发送的 param_id 保留其当前值。您只需发送实际要更改的内容。您发送的每个 param_id 都会根据服务提供商目录进行校验。响应
返回更新后的连接,结构与 检索连接 相同。curl -X PATCH 'https://api.y.uno/v1/connections/f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e' \
-H 'public-api-key: <YOUR_PUBLIC_KEY>' \
-H 'private-secret-key: <YOUR_SECRET_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"account_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"params": [
{ "param_id": "SECRET_KEY", "value": "sk_live_new..." }
]
}'
curl -X PATCH 'https://api.y.uno/v1/connections/f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e' \
-H 'public-api-key: <YOUR_PUBLIC_KEY>' \
-H 'private-secret-key: <YOUR_SECRET_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"account_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"merchant_connection_id": "stripe-us-prod-002"
}'
{
"connection_id": "f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e",
"merchant_connection_id": "stripe-us-prod-002",
"provider_id": "STRIPE",
"status": "ACTIVE",
"flow_type": "PAYIN",
"payment_methods": ["CARD"],
"params": [
{ "param_id": "INTEGRATION_TYPE", "value": "STRIPE_CHARGES" },
{ "param_id": "SECRET_KEY", "value": "***" },
{ "param_id": "RADAR_FRAUD_ANALYSIS", "value": false },
{ "param_id": "SEND_RECEIPT_EMAIL_PARAMETER", "value": false },
{ "param_id": "SETUP_FUTURE_USAGE", "value": false },
{ "param_id": "ORDER_ID", "value": "DEFAULT" }
],
"costs": [
{
"sort_number": 1,
"cost_name": "Transaction Fee",
"currency": "USD",
"cost_values": {
"successful": { "fixed_fee": 0.30, "percentage": 2.9 },
"unsuccessful": { "fixed_fee": 0.0, "percentage": 0.0 }
}
}
],
"created_at": "2026-05-12T10:24:00Z",
"updated_at": "2026-05-12T11:02:17Z"
}
{
"type": "validation_error",
"code": "UNKNOWN_PARAM",
"message": "Param 'FOO' is not part of provider 'STRIPE' catalog",
"details": { "provider_id": "STRIPE", "param_id": "FOO" }
}
{
"type": "conflict",
"code": "CONNECTION_MERCHANT_ID_CONFLICT",
"message": "A connection with merchant_connection_id 'stripe-us-prod-002' already exists in this account",
"details": { "merchant_connection_id": "stripe-us-prod-002" }
}
密钥信息处理:目录中标记为
secret: true 的参数始终以 "value": "***" 返回。回传 "***" 并不能保留密钥信息:只需完全省略该 param_id,其存储的值就会被保留。错误
| HTTP | code |
|---|---|
400 | UNKNOWN_PARAM某个 param_id 不属于该服务提供商目录。 |
400 | INVALID_PARAM_VALUE某个值与目录中的 field_type 或允许的选项不匹配。 |
400 | UNSUPPORTED_CURRENCY某个 costs[].currency 不在该服务提供商支持的列表中。 |
400 | VALIDATION_ERRORconnection_id 不是有效的 UUID,或 merchant_connection_id 超过 255 个字符。 |
400 | MALFORMED_BODY请求体不是有效的 JSON。 |
401 | NOT_AUTHENTICATEDAPI 密钥缺失或无效。 |
404 | CONNECTION_NOT_FOUND未知的 connection_id,或该 id 属于其他账户。 |
409 | CONNECTION_MERCHANT_ID_CONFLICTmerchant_connection_id 已存在于此账户中。 |
授权
请求体
application/json
响应
OK
此页面对您有帮助吗?
⌘I
更新连接
curl --request PATCH \
--url https://api-sandbox.y.uno/v1/connections/{connection_id} \
--header 'Content-Type: application/json' \
--header 'PRIVATE-SECRET-KEY: <api-key>' \
--header 'PUBLIC-API-KEY: <api-key>' \
--data '
{
"account_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"merchant_connection_id": "stripe-us-prod-002",
"params": [
{
"param_id": "SECRET_KEY",
"value": "sk_live_..."
}
],
"costs": [
{
"sort_number": 1,
"cost_name": "Transaction Fee",
"currency": "USD",
"cost_values": {
"successful": {
"fixed_fee": 0.25,
"percentage": 2.7
},
"unsuccessful": {
"fixed_fee": 0,
"percentage": 0
}
}
}
]
}
'import requests
url = "https://api-sandbox.y.uno/v1/connections/{connection_id}"
payload = {
"account_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"merchant_connection_id": "stripe-us-prod-002",
"params": [
{
"param_id": "SECRET_KEY",
"value": "sk_live_..."
}
],
"costs": [
{
"sort_number": 1,
"cost_name": "Transaction Fee",
"currency": "USD",
"cost_values": {
"successful": {
"fixed_fee": 0.25,
"percentage": 2.7
},
"unsuccessful": {
"fixed_fee": 0,
"percentage": 0
}
}
}
]
}
headers = {
"PUBLIC-API-KEY": "<api-key>",
"PRIVATE-SECRET-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
'PUBLIC-API-KEY': '<api-key>',
'PRIVATE-SECRET-KEY': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
account_id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
merchant_connection_id: 'stripe-us-prod-002',
params: [{param_id: 'SECRET_KEY', value: 'sk_live_...'}],
costs: [
{
sort_number: 1,
cost_name: 'Transaction Fee',
currency: 'USD',
cost_values: {
successful: {fixed_fee: 0.25, percentage: 2.7},
unsuccessful: {fixed_fee: 0, percentage: 0}
}
}
]
})
};
fetch('https://api-sandbox.y.uno/v1/connections/{connection_id}', 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.y.uno/v1/connections/{connection_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'account_id' => 'a1b2c3d4-e5f6-7890-abcd-ef1234567890',
'merchant_connection_id' => 'stripe-us-prod-002',
'params' => [
[
'param_id' => 'SECRET_KEY',
'value' => 'sk_live_...'
]
],
'costs' => [
[
'sort_number' => 1,
'cost_name' => 'Transaction Fee',
'currency' => 'USD',
'cost_values' => [
'successful' => [
'fixed_fee' => 0.25,
'percentage' => 2.7
],
'unsuccessful' => [
'fixed_fee' => 0,
'percentage' => 0
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"PRIVATE-SECRET-KEY: <api-key>",
"PUBLIC-API-KEY: <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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-sandbox.y.uno/v1/connections/{connection_id}"
payload := strings.NewReader("{\n \"account_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"merchant_connection_id\": \"stripe-us-prod-002\",\n \"params\": [\n {\n \"param_id\": \"SECRET_KEY\",\n \"value\": \"sk_live_...\"\n }\n ],\n \"costs\": [\n {\n \"sort_number\": 1,\n \"cost_name\": \"Transaction Fee\",\n \"currency\": \"USD\",\n \"cost_values\": {\n \"successful\": {\n \"fixed_fee\": 0.25,\n \"percentage\": 2.7\n },\n \"unsuccessful\": {\n \"fixed_fee\": 0,\n \"percentage\": 0\n }\n }\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("PUBLIC-API-KEY", "<api-key>")
req.Header.Add("PRIVATE-SECRET-KEY", "<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.patch("https://api-sandbox.y.uno/v1/connections/{connection_id}")
.header("PUBLIC-API-KEY", "<api-key>")
.header("PRIVATE-SECRET-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"merchant_connection_id\": \"stripe-us-prod-002\",\n \"params\": [\n {\n \"param_id\": \"SECRET_KEY\",\n \"value\": \"sk_live_...\"\n }\n ],\n \"costs\": [\n {\n \"sort_number\": 1,\n \"cost_name\": \"Transaction Fee\",\n \"currency\": \"USD\",\n \"cost_values\": {\n \"successful\": {\n \"fixed_fee\": 0.25,\n \"percentage\": 2.7\n },\n \"unsuccessful\": {\n \"fixed_fee\": 0,\n \"percentage\": 0\n }\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/connections/{connection_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["PUBLIC-API-KEY"] = '<api-key>'
request["PRIVATE-SECRET-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": \"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\n \"merchant_connection_id\": \"stripe-us-prod-002\",\n \"params\": [\n {\n \"param_id\": \"SECRET_KEY\",\n \"value\": \"sk_live_...\"\n }\n ],\n \"costs\": [\n {\n \"sort_number\": 1,\n \"cost_name\": \"Transaction Fee\",\n \"currency\": \"USD\",\n \"cost_values\": {\n \"successful\": {\n \"fixed_fee\": 0.25,\n \"percentage\": 2.7\n },\n \"unsuccessful\": {\n \"fixed_fee\": 0,\n \"percentage\": 0\n }\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"connection_id": "f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e",
"merchant_connection_id": "stripe-us-prod-002",
"provider_id": "STRIPE",
"status": "ACTIVE",
"flow_type": "PAYIN",
"payment_methods": [
"CARD"
],
"params": [
{
"param_id": "SECRET_KEY",
"value": "***"
}
],
"costs": [
{
"sort_number": 1,
"cost_name": "Transaction Fee",
"currency": "USD"
}
],
"created_at": "2026-05-12T10:24:00Z",
"updated_at": "2026-05-12T11:02:17Z"
}{
"type": "validation_error",
"code": "UNKNOWN_PARAM",
"message": "Param 'FOO' is not part of provider 'STRIPE' catalog"
}{
"type": "auth_error",
"code": "NOT_AUTHENTICATED",
"message": "Not authenticated"
}{
"type": "not_found",
"code": "CONNECTION_NOT_FOUND",
"message": "Connection '...' was not found"
}{
"type": "conflict",
"code": "CONNECTION_MERCHANT_ID_CONFLICT",
"message": "A connection with merchant_connection_id 'stripe-us-prod-002' already exists in this account"
}