路由
更新路由
替换现有路由的完整配置,通过其 routing_id 识别。
PATCH
/
routing
/
{routing_id}
更新路由配置
curl --request PATCH \
--url https://api-sandbox.y.uno/v1/routing/{routing_id} \
--header 'Content-Type: application/json' \
--header 'PRIVATE-SECRET-KEY: <api-key>' \
--header 'PUBLIC-API-KEY: <api-key>' \
--header 'X-Idempotency-Key: <x-idempotency-key>' \
--data '
{
"account_id": "7825fc5e-e50a-4248-9ae8-5d3786afb0be",
"payment_method": "GOOGLE_PAY",
"name": "Google Pay routing v2",
"default_route": {
"steps": [
{
"index": 1,
"provider_id": "ADYEN",
"connection_id": "b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f",
"output": [
{
"status": "APPROVED",
"next": 3
},
{
"status": "DECLINED",
"retry": false,
"next_split": [
{
"index": 2,
"percentage": 70
},
{
"index": 4,
"percentage": 30
}
]
}
]
},
{
"index": 2,
"provider_id": "ADYEN",
"connection_id": "b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f",
"output": [
{
"status": "APPROVED",
"next": 3
}
]
},
{
"index": 3,
"action": "CAPTURE",
"action_delay": "PT5M"
},
{
"index": 4,
"action": "CANCEL"
}
]
},
"condition_sets": [
{
"sort_number": 1,
"name": "US & Canada",
"conditions": [
{
"condition_type": "COUNTRY",
"conditional": "ONE_OF",
"values": [
"US",
"CA"
]
}
],
"route": {
"steps": [
{
"index": 1,
"action": "CANCEL"
}
]
}
}
]
}
'import requests
url = "https://api-sandbox.y.uno/v1/routing/{routing_id}"
payload = {
"account_id": "7825fc5e-e50a-4248-9ae8-5d3786afb0be",
"payment_method": "GOOGLE_PAY",
"name": "Google Pay routing v2",
"default_route": { "steps": [
{
"index": 1,
"provider_id": "ADYEN",
"connection_id": "b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f",
"output": [
{
"status": "APPROVED",
"next": 3
},
{
"status": "DECLINED",
"retry": False,
"next_split": [
{
"index": 2,
"percentage": 70
},
{
"index": 4,
"percentage": 30
}
]
}
]
},
{
"index": 2,
"provider_id": "ADYEN",
"connection_id": "b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f",
"output": [
{
"status": "APPROVED",
"next": 3
}
]
},
{
"index": 3,
"action": "CAPTURE",
"action_delay": "PT5M"
},
{
"index": 4,
"action": "CANCEL"
}
] },
"condition_sets": [
{
"sort_number": 1,
"name": "US & Canada",
"conditions": [
{
"condition_type": "COUNTRY",
"conditional": "ONE_OF",
"values": ["US", "CA"]
}
],
"route": { "steps": [
{
"index": 1,
"action": "CANCEL"
}
] }
}
]
}
headers = {
"X-Idempotency-Key": "<x-idempotency-key>",
"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: {
'X-Idempotency-Key': '<x-idempotency-key>',
'PUBLIC-API-KEY': '<api-key>',
'PRIVATE-SECRET-KEY': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
account_id: '7825fc5e-e50a-4248-9ae8-5d3786afb0be',
payment_method: 'GOOGLE_PAY',
name: 'Google Pay routing v2',
default_route: {
steps: [
{
index: 1,
provider_id: 'ADYEN',
connection_id: 'b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f',
output: [
{status: 'APPROVED', next: 3},
{
status: 'DECLINED',
retry: false,
next_split: [{index: 2, percentage: 70}, {index: 4, percentage: 30}]
}
]
},
{
index: 2,
provider_id: 'ADYEN',
connection_id: 'b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f',
output: [{status: 'APPROVED', next: 3}]
},
{index: 3, action: 'CAPTURE', action_delay: 'PT5M'},
{index: 4, action: 'CANCEL'}
]
},
condition_sets: [
{
sort_number: 1,
name: 'US & Canada',
conditions: [{condition_type: 'COUNTRY', conditional: 'ONE_OF', values: ['US', 'CA']}],
route: {steps: [{index: 1, action: 'CANCEL'}]}
}
]
})
};
fetch('https://api-sandbox.y.uno/v1/routing/{routing_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/routing/{routing_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' => '7825fc5e-e50a-4248-9ae8-5d3786afb0be',
'payment_method' => 'GOOGLE_PAY',
'name' => 'Google Pay routing v2',
'default_route' => [
'steps' => [
[
'index' => 1,
'provider_id' => 'ADYEN',
'connection_id' => 'b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f',
'output' => [
[
'status' => 'APPROVED',
'next' => 3
],
[
'status' => 'DECLINED',
'retry' => false,
'next_split' => [
[
'index' => 2,
'percentage' => 70
],
[
'index' => 4,
'percentage' => 30
]
]
]
]
],
[
'index' => 2,
'provider_id' => 'ADYEN',
'connection_id' => 'b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f',
'output' => [
[
'status' => 'APPROVED',
'next' => 3
]
]
],
[
'index' => 3,
'action' => 'CAPTURE',
'action_delay' => 'PT5M'
],
[
'index' => 4,
'action' => 'CANCEL'
]
]
],
'condition_sets' => [
[
'sort_number' => 1,
'name' => 'US & Canada',
'conditions' => [
[
'condition_type' => 'COUNTRY',
'conditional' => 'ONE_OF',
'values' => [
'US',
'CA'
]
]
],
'route' => [
'steps' => [
[
'index' => 1,
'action' => 'CANCEL'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"PRIVATE-SECRET-KEY: <api-key>",
"PUBLIC-API-KEY: <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.y.uno/v1/routing/{routing_id}"
payload := strings.NewReader("{\n \"account_id\": \"7825fc5e-e50a-4248-9ae8-5d3786afb0be\",\n \"payment_method\": \"GOOGLE_PAY\",\n \"name\": \"Google Pay routing v2\",\n \"default_route\": {\n \"steps\": [\n {\n \"index\": 1,\n \"provider_id\": \"ADYEN\",\n \"connection_id\": \"b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f\",\n \"output\": [\n {\n \"status\": \"APPROVED\",\n \"next\": 3\n },\n {\n \"status\": \"DECLINED\",\n \"retry\": false,\n \"next_split\": [\n {\n \"index\": 2,\n \"percentage\": 70\n },\n {\n \"index\": 4,\n \"percentage\": 30\n }\n ]\n }\n ]\n },\n {\n \"index\": 2,\n \"provider_id\": \"ADYEN\",\n \"connection_id\": \"b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f\",\n \"output\": [\n {\n \"status\": \"APPROVED\",\n \"next\": 3\n }\n ]\n },\n {\n \"index\": 3,\n \"action\": \"CAPTURE\",\n \"action_delay\": \"PT5M\"\n },\n {\n \"index\": 4,\n \"action\": \"CANCEL\"\n }\n ]\n },\n \"condition_sets\": [\n {\n \"sort_number\": 1,\n \"name\": \"US & Canada\",\n \"conditions\": [\n {\n \"condition_type\": \"COUNTRY\",\n \"conditional\": \"ONE_OF\",\n \"values\": [\n \"US\",\n \"CA\"\n ]\n }\n ],\n \"route\": {\n \"steps\": [\n {\n \"index\": 1,\n \"action\": \"CANCEL\"\n }\n ]\n }\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-Idempotency-Key", "<x-idempotency-key>")
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/routing/{routing_id}")
.header("X-Idempotency-Key", "<x-idempotency-key>")
.header("PUBLIC-API-KEY", "<api-key>")
.header("PRIVATE-SECRET-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"7825fc5e-e50a-4248-9ae8-5d3786afb0be\",\n \"payment_method\": \"GOOGLE_PAY\",\n \"name\": \"Google Pay routing v2\",\n \"default_route\": {\n \"steps\": [\n {\n \"index\": 1,\n \"provider_id\": \"ADYEN\",\n \"connection_id\": \"b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f\",\n \"output\": [\n {\n \"status\": \"APPROVED\",\n \"next\": 3\n },\n {\n \"status\": \"DECLINED\",\n \"retry\": false,\n \"next_split\": [\n {\n \"index\": 2,\n \"percentage\": 70\n },\n {\n \"index\": 4,\n \"percentage\": 30\n }\n ]\n }\n ]\n },\n {\n \"index\": 2,\n \"provider_id\": \"ADYEN\",\n \"connection_id\": \"b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f\",\n \"output\": [\n {\n \"status\": \"APPROVED\",\n \"next\": 3\n }\n ]\n },\n {\n \"index\": 3,\n \"action\": \"CAPTURE\",\n \"action_delay\": \"PT5M\"\n },\n {\n \"index\": 4,\n \"action\": \"CANCEL\"\n }\n ]\n },\n \"condition_sets\": [\n {\n \"sort_number\": 1,\n \"name\": \"US & Canada\",\n \"conditions\": [\n {\n \"condition_type\": \"COUNTRY\",\n \"conditional\": \"ONE_OF\",\n \"values\": [\n \"US\",\n \"CA\"\n ]\n }\n ],\n \"route\": {\n \"steps\": [\n {\n \"index\": 1,\n \"action\": \"CANCEL\"\n }\n ]\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/routing/{routing_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-Idempotency-Key"] = '<x-idempotency-key>'
request["PUBLIC-API-KEY"] = '<api-key>'
request["PRIVATE-SECRET-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": \"7825fc5e-e50a-4248-9ae8-5d3786afb0be\",\n \"payment_method\": \"GOOGLE_PAY\",\n \"name\": \"Google Pay routing v2\",\n \"default_route\": {\n \"steps\": [\n {\n \"index\": 1,\n \"provider_id\": \"ADYEN\",\n \"connection_id\": \"b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f\",\n \"output\": [\n {\n \"status\": \"APPROVED\",\n \"next\": 3\n },\n {\n \"status\": \"DECLINED\",\n \"retry\": false,\n \"next_split\": [\n {\n \"index\": 2,\n \"percentage\": 70\n },\n {\n \"index\": 4,\n \"percentage\": 30\n }\n ]\n }\n ]\n },\n {\n \"index\": 2,\n \"provider_id\": \"ADYEN\",\n \"connection_id\": \"b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f\",\n \"output\": [\n {\n \"status\": \"APPROVED\",\n \"next\": 3\n }\n ]\n },\n {\n \"index\": 3,\n \"action\": \"CAPTURE\",\n \"action_delay\": \"PT5M\"\n },\n {\n \"index\": 4,\n \"action\": \"CANCEL\"\n }\n ]\n },\n \"condition_sets\": [\n {\n \"sort_number\": 1,\n \"name\": \"US & Canada\",\n \"conditions\": [\n {\n \"condition_type\": \"COUNTRY\",\n \"conditional\": \"ONE_OF\",\n \"values\": [\n \"US\",\n \"CA\"\n ]\n }\n ],\n \"route\": {\n \"steps\": [\n {\n \"index\": 1,\n \"action\": \"CANCEL\"\n }\n ]\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "8f2c1d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
"account_id": "acc-uuid",
"payment_method": "CARD",
"name": "Updated Card routing v2",
"default_route": {
"start_split": [
{
"index": 1,
"percentage": 45
}
],
"steps": [
{
"index": 1,
"provider_id": "STRIPE",
"connection_id": "f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e",
"provider_type": "PAYMENT",
"timeout": 60,
"network_token_enable": true,
"network_token_on": true,
"three_d_secure_exemptions": [
"LOW_VALUE"
],
"action": "CANCEL",
"action_delay": "PT5M",
"output": [
{
"status": "DECLINED",
"decline_types": [
"<string>"
],
"group_id": 1044,
"group_name": "Soft declines",
"retry": false,
"next": 2,
"next_split": [
{
"index": 2,
"percentage": 70
}
]
}
],
"fraud": {
"rules": "rule-a,rule-b",
"blocklists": "<string>",
"allowlists": "<string>",
"reviewlists": "<string>",
"preset": "<string>",
"report_only": true
},
"smart_routing": {
"type": "LATENCY",
"providers": [
{
"provider_id": "ADYEN",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"network_token_on": true
}
],
"no_retry_decline_types": [
"<string>"
],
"no_retry_decline_group_ids": [
5120
],
"no_retry_failure_causes": [
"<string>"
]
}
}
]
},
"condition_sets": [
{
"sort_number": 1,
"name": "Updated Card routing",
"description": "<string>",
"conditions": [
{
"condition_type": "COUNTRY",
"conditional": "ONE_OF",
"values": [
"US",
"CA"
],
"key": "<string>",
"item_values": [
"GC-50",
"GC-100",
"GC-200"
],
"currency": "USD",
"time_period_repeat_amount": 1,
"time_period_repeat_frequency": "DAILY",
"time_period_repetition_days": [
"MONDAY"
],
"time_period_start_time": "09:00:00",
"time_period_end_time": "18:00:00",
"timezone": "-03:00",
"limit_by": "PAYMENTS",
"payments_count": "ALL"
}
],
"route": {}
}
],
"created_at": "2026-05-12T14:30:00Z",
"updated_at": "2026-05-12T14:30:00Z"
}{
"code": "ROUTING_VALIDATION_FAILED",
"messages": [
"Validation failed for update"
]
}{
"code": "NOT_AUTHENTICATED",
"messages": [
"Not authenticated"
]
}{
"code": "ROUTING_NOT_FOUND",
"messages": [
"Routing '...' was not found"
]
}{
"code": "ROUTING_VERSION_CONFLICT",
"messages": [
"Another concurrent PATCH won the publish race"
]
}替换路由的完整配置。请求体的结构与创建路由相同:新的
default_route 和 condition_sets[] 会完全取代之前生效的状态。不存在字段级合并。
account_id 和 payment_method 与 routing_id 绑定:它们在创建时设置,无法通过 PATCH 更改。两者仍然必须出现在请求体中,并且必须与该路由一致。
这同样适用于百分比拆分:发送时不带 start_split 的条件集会恢复为步骤 1 上的单一入口,发送时不带 next_split 的输出只保留其声明的 next。如果您想保留路由已有的拆分,请先检索该路由。
请求体中省略的内容并不都会被删除。请求省略的各个部分的处理结果如下:
| 请求中省略的部分 | 结果 |
|---|---|
输出上的 retry | 按该位置存储的值保留。发送 retry: false 可关闭重试。 |
已存储的 CAPTURE 或 HOLD_FOR_REVIEW 步骤,且其所挂接的输出发送时不带 next | 保留并重新挂接。省略它不会删除自动捕获;请改为将该输出指向另一个步骤。 |
CAPTURE 步骤上的 action_delay | 按存储的值保留。发送带有新 action_delay 的步骤可更改它。 |
欺诈步骤上的 fraud | 按存储的值保留。如果发送了该字段,这六个字段会被替换。 |
支付步骤上的 network_token_on | 按存储的值保留。发送 network_token_on: false 可将其关闭。发回已存储的值不会再次校验;只有更改后的值才会经过网络令牌检查。 |
3DS 步骤上的 three_d_secure_exemptions | 按存储的值保留。发送 three_d_secure_exemptions: [] 可将其清空。 |
| 已存储的 Smart Routing 步骤 | 删除。Smart Routing 步骤属于请求本身:不携带该步骤的请求体(例如在此 API 能看到 Smart Routing 之前检索到的请求体)会将其删除。请先检索路由,再将该步骤发回。 |
CANCEL 或 REVERT 步骤 | 删除,与请求体未携带的任何其他步骤一样。 |
start_split / next_split | 重置:发送时不带 start_split 的条件集会恢复为步骤 1 上的单一入口,发送时不带 next_split 的输出只保留其 next。 |
API 不返回的部分(REFUND、DECLINE 和 END 操作、监控) | 完全按存储的内容保留,因此将检索路由返回的内容发回,路由会保持原样。请在 Dashboard 中更改这些部分。请参阅 API 不显示的内容。 |
路径参数
创建路由返回的 id。
请求体
没有任何
condition_sets[] 匹配时使用的路由。显示 属性
显示 属性
可选。按百分比将路由的入口拆分到多个步骤,格式为
[{ "index": 1, "percentage": 45 }, { "index": 2, "percentage": 55 }]。百分比为整数,总和必须为 100。省略时每笔支付都从步骤 1 开始。请参阅百分比拆分。每个步骤要么是一次服务提供商尝试,要么是一个操作步骤。
index 值从 1 开始连续编号。显示 项
显示 项
欺诈服务提供商步骤的配置:
rules、blocklists、allowlists、reviewlists、preset(从 Dashboard 复制的代码,按原样保留)和 report_only。仅用于 FRAUD 服务提供商。请参阅服务提供商步骤类型。仅用于
CARD 路由的支付服务提供商步骤。为 true 时,如果卡片有可用的网络令牌,则使用该网络令牌支付。组织必须已完成网络令牌接入,且服务提供商必须支持网络令牌(响应中的 network_token_enable),否则返回 400 NETWORK_TOKEN_NOT_ONBOARDED 或 400 NETWORK_TOKEN_NOT_SUPPORTED。省略时保留存储的值;发送 false 可将其关闭。请参阅服务提供商步骤设置。使该步骤成为 Smart Routing 步骤:
type(COSTS 或 LATENCY)、providers(2 到 4 个 { provider_id, connection_id, network_token_on } 支付服务提供商)、no_retry_decline_types 和 no_retry_decline_group_ids(拒绝组 id,包括 ISO 代码组)。仅限卡片路由,每个路由一个。请参阅Smart Routing 步骤。使该步骤成为操作步骤:
CANCEL 驳回支付,CAPTURE 捕获授权,HOLD_FOR_REVIEW 使其保持待处理状态以等待人工审核,REVERT 在支付之后运行的欺诈筛查结束后撤销该支付。CAPTURE 和 HOLD_FOR_REVIEW 只能从支付步骤或 Smart Routing 步骤的 APPROVED 或 SUCCEEDED_GROUP 输出到达,REVERT 只能从在支付之后运行的欺诈步骤的输出到达,CANCEL 永远不能从批准结果到达。操作步骤没有 provider_id、connection_id 或 output。请参阅操作步骤。仅在
action = CAPTURE 时使用。批准与捕获之间的 ISO-8601 时长,最少 PT1M,最多 P7D(例如 PT5M、PT3H、P2D)。省略时保留存储的延迟;不带该字段的新步骤会在批准处理完成后立即捕获。定义如何处理此步骤的每种可能结果。操作步骤上不允许使用。
显示 项
显示 项
拒绝子状态(例如
INSUFFICIENT_FUNDS、DECLINED_BY_BANK),或在 ISO_CODE_GROUP 上使用的 ISO 8583 响应代码(例如 51、9G),每个值去除首尾空格后为 1 到 30 个字符,比较时不区分大小写。在 DECLINE_GROUP 和 ISO_CODE_GROUP 上,除非发送了 group_id,否则必填;发送 group_id 时,它必须与该组的成员一致。SUCCEEDED_GROUP 上不允许使用。为
true 时,出现此结果后会先用同一服务提供商再尝试一次,然后再执行 next。仅用于 DECLINED、INTERNAL_ERROR、DECLINE_GROUP 和 ISO_CODE_GROUP;MAC_CODE_GROUP 仍然驳回 retry: true。省略时保留存储的值。有关 Merchant Advice Code 组上的 DECLINE_GROUP 条目,请参阅重试。可选。按
sort_number 排序,第一个匹配的条件集生效。显示 项
显示 项
必须匹配的条件列表。除
condition_type、conditional、values、key 和 currency 之外,TIME_PERIOD 条件还携带其时间安排字段,VOLUME_PAYMENTS_LIMIT 条件携带其 limit_by、payments_count 和周期字段,ORDER_ITEMS_AMOUNT 条件携带其 item_values。响应
默认路由逻辑,结构如检索路由所述。
curl -X PATCH 'https://api.y.uno/v1/routing/8f2c1d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f' \
-H 'public-api-key: <YOUR_PUBLIC_KEY>' \
-H 'private-secret-key: <YOUR_SECRET_KEY>' \
-H 'Content-Type: application/json' \
-H 'X-Idempotency-Key: <UUID>' \
-d '{
"account_id": "7825fc5e-e50a-4248-9ae8-5d3786afb0be",
"payment_method": "CARD",
"name": "Card routing v2 — business-hours rule and monthly limit",
"default_route": {
"steps": [
{
"index": 1,
"provider_id": "STRIPE",
"connection_id": "f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e",
"output": [
{ "status": "DECLINED", "next": 2, "retry": false },
{ "status": "INTERNAL_ERROR", "next": 2, "retry": false }
]
},
{
"index": 2,
"provider_id": "ADYEN",
"connection_id": "b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f"
}
]
},
"condition_sets": [
{
"sort_number": 1,
"name": "First USD 50,000 of the month via dLocal",
"conditions": [
{ "condition_type": "VOLUME_PAYMENTS_LIMIT", "conditional": "LESS_OR_EQUAL_THAN", "values": ["50000"],
"currency": "USD", "limit_by": "VOLUME", "payments_count": "ALL",
"time_period_repeat_amount": 1, "time_period_repeat_frequency": "MONTHLY", "timezone": "-03:00" }
],
"route": {
"steps": [
{ "index": 1, "provider_id": "DLOCAL", "connection_id": "c3d5e6f7-2b3c-4d5e-8f6a-7b8c9d0e1f2a" }
]
}
},
{
"sort_number": 2,
"name": "Business hours via Adyen",
"conditions": [
{ "condition_type": "TIME_PERIOD", "conditional": "EQUAL", "values": ["2026-10-01T00:00:00-03:00"],
"time_period_repeat_amount": 1, "time_period_repeat_frequency": "WEEKLY",
"time_period_repetition_days": ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY"],
"time_period_start_time": "09:00:00", "time_period_end_time": "18:00:00", "timezone": "-03:00" }
],
"route": {
"steps": [
{ "index": 1, "provider_id": "ADYEN", "connection_id": "b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f" }
]
}
}
]
}'
{
"id": "8f2c1d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
"account_id": "7825fc5e-e50a-4248-9ae8-5d3786afb0be",
"payment_method": "CARD",
"name": "Card routing v2 — business-hours rule and monthly limit",
"default_route": {
"steps": [
{
"index": 1,
"provider_id": "STRIPE",
"connection_id": "f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e",
"output": [
{ "status": "DECLINED", "next": 2, "retry": false },
{ "status": "INTERNAL_ERROR", "next": 2, "retry": false }
]
},
{ "index": 2, "provider_id": "ADYEN", "connection_id": "b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f", "output": [{ "status": "APPROVED", "next": null, "decline_types": null, "retry": false }, { "status": "INTERNAL_ERROR", "next": null, "decline_types": null, "retry": false }] }
]
},
"condition_sets": [
{
"sort_number": 1,
"name": "First USD 50,000 of the month via dLocal",
"conditions": [
{ "condition_type": "VOLUME_PAYMENTS_LIMIT", "conditional": "LESS_OR_EQUAL_THAN", "values": ["50000"],
"currency": "USD", "limit_by": "VOLUME", "payments_count": "ALL",
"time_period_repeat_amount": 1, "time_period_repeat_frequency": "MONTHLY", "timezone": "-03:00" }
],
"route": { "steps": [ { "index": 1, "provider_id": "DLOCAL", "connection_id": "c3d5e6f7-2b3c-4d5e-8f6a-7b8c9d0e1f2a", "output": [{ "status": "APPROVED", "next": null, "decline_types": null, "retry": false }, { "status": "INTERNAL_ERROR", "next": null, "decline_types": null, "retry": false }] } ] }
},
{
"sort_number": 2,
"name": "Business hours via Adyen",
"conditions": [
{ "condition_type": "TIME_PERIOD", "conditional": "EQUAL", "values": ["2026-10-01T00:00:00-03:00"],
"time_period_repeat_amount": 1, "time_period_repeat_frequency": "WEEKLY",
"time_period_repetition_days": ["MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY"],
"time_period_start_time": "09:00:00", "time_period_end_time": "18:00:00", "timezone": "-03:00" }
],
"route": { "steps": [ { "index": 1, "provider_id": "ADYEN", "connection_id": "b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f", "output": [{ "status": "APPROVED", "next": null, "decline_types": null, "retry": false }, { "status": "INTERNAL_ERROR", "next": null, "decline_types": null, "retry": false }] } ] }
}
],
"created_at": "2026-05-12T14:30:00Z",
"updated_at": "2026-05-13T09:18:42Z"
}
{
"code": "ROUTING_PAYMENT_METHOD_IMMUTABLE",
"messages": ["payment_method cannot be changed once the routing is created. Stored payment_method='CARD', requested='PIX'."]
}
{
"code": "INVALID_ROUTE_CONFIGURATION",
"messages": ["output.group_id=1044 is a DECLINE_GROUP group and cannot be used with status MAC_CODE_GROUP"]
}
错误
| HTTP | code |
|---|---|
404 | ROUTING_NOT_FOUND未知的 routing_id,或该 id 属于其他账户。 |
400 | INVALID_PARAMETERS某个字段缺失或值无效:步骤既没有 provider_id 也没有 action,status 或 action 超出其枚举范围,在非 CAPTURE 步骤上使用了 action_delay,group_id 格式错误。messages 会指出出错的字段。 |
400 | INVALID_FORMAT某个字段的类型或格式错误: time_period_start_time / time_period_end_time 不是 HH:mm:ss,TIME_PERIOD 条件的 values 中的日期不是 ISO-8601,time_period_repeat_amount 或 sort_number 不是整数,retry 不是布尔值。messages 会指出该字段。 |
400 | INVALID_ROUTE_CONFIGURATION违反路由规则:步骤索引不连续, next 或拆分分支指向不存在的步骤,拆分总和不为 100 或导致某个步骤无法到达,CAPTURE 或 HOLD_FOR_REVIEW 步骤并非只从 APPROVED 到达,action_delay 小于 1 分钟或大于 7 天,在不支持 retry 的状态上使用它,或在已存储路由尚未重试的 Merchant Advice Code 组上使用它(请参阅重试),group_id 未知、属于其他账户或类型错误,decline_types 与组不一致,在非 3DS 服务提供商步骤上使用 LIABILITY_SHIFTED、LIABILITY_NOT_SHIFTED 或 LIABILITY_NOT_REPORTED,或将它们与 group_id、decline_types 或 retry: true 一起使用(请参阅责任转移输出),条件违反其 condition_type 的规则,或者找不到该账户和服务提供商对应的 connection_id。messages 会说明违反了哪条规则。 |
400 | INVALID_VOLUME_LIMIT_CURRENCY、INVALID_VOLUME_LIMIT_PERIOD、UNSUPPORTED_VOLUME_LIMIT_TIMEZONEVOLUME_PAYMENTS_LIMIT 条件的币种、周期或时区无效。请参阅金额与笔数限制。 |
400 | INVALID_PROVIDER_IDprovider_id 格式无效。 |
400 | ROUTING_PAYMENT_METHOD_IMMUTABLE请求体中的 payment_method 与路由的 payment_method 不一致。 |
409 | ROUTING_VERSION_CONFLICT另一个并发的 PATCH 在发布竞争中胜出。 |
401 | NOT_AUTHENTICATED缺少 public-api-key 或 private-secret-key 标头。 |
401 | INVALID_CREDENTIALS密钥对错误,或使用了 Dashboard Customized API key。请改用账户密钥或组织密钥。 |
授权
请求体
application/json
响应
OK
此页面对您有帮助吗?
⌘I
更新路由配置
curl --request PATCH \
--url https://api-sandbox.y.uno/v1/routing/{routing_id} \
--header 'Content-Type: application/json' \
--header 'PRIVATE-SECRET-KEY: <api-key>' \
--header 'PUBLIC-API-KEY: <api-key>' \
--header 'X-Idempotency-Key: <x-idempotency-key>' \
--data '
{
"account_id": "7825fc5e-e50a-4248-9ae8-5d3786afb0be",
"payment_method": "GOOGLE_PAY",
"name": "Google Pay routing v2",
"default_route": {
"steps": [
{
"index": 1,
"provider_id": "ADYEN",
"connection_id": "b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f",
"output": [
{
"status": "APPROVED",
"next": 3
},
{
"status": "DECLINED",
"retry": false,
"next_split": [
{
"index": 2,
"percentage": 70
},
{
"index": 4,
"percentage": 30
}
]
}
]
},
{
"index": 2,
"provider_id": "ADYEN",
"connection_id": "b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f",
"output": [
{
"status": "APPROVED",
"next": 3
}
]
},
{
"index": 3,
"action": "CAPTURE",
"action_delay": "PT5M"
},
{
"index": 4,
"action": "CANCEL"
}
]
},
"condition_sets": [
{
"sort_number": 1,
"name": "US & Canada",
"conditions": [
{
"condition_type": "COUNTRY",
"conditional": "ONE_OF",
"values": [
"US",
"CA"
]
}
],
"route": {
"steps": [
{
"index": 1,
"action": "CANCEL"
}
]
}
}
]
}
'import requests
url = "https://api-sandbox.y.uno/v1/routing/{routing_id}"
payload = {
"account_id": "7825fc5e-e50a-4248-9ae8-5d3786afb0be",
"payment_method": "GOOGLE_PAY",
"name": "Google Pay routing v2",
"default_route": { "steps": [
{
"index": 1,
"provider_id": "ADYEN",
"connection_id": "b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f",
"output": [
{
"status": "APPROVED",
"next": 3
},
{
"status": "DECLINED",
"retry": False,
"next_split": [
{
"index": 2,
"percentage": 70
},
{
"index": 4,
"percentage": 30
}
]
}
]
},
{
"index": 2,
"provider_id": "ADYEN",
"connection_id": "b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f",
"output": [
{
"status": "APPROVED",
"next": 3
}
]
},
{
"index": 3,
"action": "CAPTURE",
"action_delay": "PT5M"
},
{
"index": 4,
"action": "CANCEL"
}
] },
"condition_sets": [
{
"sort_number": 1,
"name": "US & Canada",
"conditions": [
{
"condition_type": "COUNTRY",
"conditional": "ONE_OF",
"values": ["US", "CA"]
}
],
"route": { "steps": [
{
"index": 1,
"action": "CANCEL"
}
] }
}
]
}
headers = {
"X-Idempotency-Key": "<x-idempotency-key>",
"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: {
'X-Idempotency-Key': '<x-idempotency-key>',
'PUBLIC-API-KEY': '<api-key>',
'PRIVATE-SECRET-KEY': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
account_id: '7825fc5e-e50a-4248-9ae8-5d3786afb0be',
payment_method: 'GOOGLE_PAY',
name: 'Google Pay routing v2',
default_route: {
steps: [
{
index: 1,
provider_id: 'ADYEN',
connection_id: 'b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f',
output: [
{status: 'APPROVED', next: 3},
{
status: 'DECLINED',
retry: false,
next_split: [{index: 2, percentage: 70}, {index: 4, percentage: 30}]
}
]
},
{
index: 2,
provider_id: 'ADYEN',
connection_id: 'b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f',
output: [{status: 'APPROVED', next: 3}]
},
{index: 3, action: 'CAPTURE', action_delay: 'PT5M'},
{index: 4, action: 'CANCEL'}
]
},
condition_sets: [
{
sort_number: 1,
name: 'US & Canada',
conditions: [{condition_type: 'COUNTRY', conditional: 'ONE_OF', values: ['US', 'CA']}],
route: {steps: [{index: 1, action: 'CANCEL'}]}
}
]
})
};
fetch('https://api-sandbox.y.uno/v1/routing/{routing_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/routing/{routing_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' => '7825fc5e-e50a-4248-9ae8-5d3786afb0be',
'payment_method' => 'GOOGLE_PAY',
'name' => 'Google Pay routing v2',
'default_route' => [
'steps' => [
[
'index' => 1,
'provider_id' => 'ADYEN',
'connection_id' => 'b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f',
'output' => [
[
'status' => 'APPROVED',
'next' => 3
],
[
'status' => 'DECLINED',
'retry' => false,
'next_split' => [
[
'index' => 2,
'percentage' => 70
],
[
'index' => 4,
'percentage' => 30
]
]
]
]
],
[
'index' => 2,
'provider_id' => 'ADYEN',
'connection_id' => 'b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f',
'output' => [
[
'status' => 'APPROVED',
'next' => 3
]
]
],
[
'index' => 3,
'action' => 'CAPTURE',
'action_delay' => 'PT5M'
],
[
'index' => 4,
'action' => 'CANCEL'
]
]
],
'condition_sets' => [
[
'sort_number' => 1,
'name' => 'US & Canada',
'conditions' => [
[
'condition_type' => 'COUNTRY',
'conditional' => 'ONE_OF',
'values' => [
'US',
'CA'
]
]
],
'route' => [
'steps' => [
[
'index' => 1,
'action' => 'CANCEL'
]
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"PRIVATE-SECRET-KEY: <api-key>",
"PUBLIC-API-KEY: <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.y.uno/v1/routing/{routing_id}"
payload := strings.NewReader("{\n \"account_id\": \"7825fc5e-e50a-4248-9ae8-5d3786afb0be\",\n \"payment_method\": \"GOOGLE_PAY\",\n \"name\": \"Google Pay routing v2\",\n \"default_route\": {\n \"steps\": [\n {\n \"index\": 1,\n \"provider_id\": \"ADYEN\",\n \"connection_id\": \"b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f\",\n \"output\": [\n {\n \"status\": \"APPROVED\",\n \"next\": 3\n },\n {\n \"status\": \"DECLINED\",\n \"retry\": false,\n \"next_split\": [\n {\n \"index\": 2,\n \"percentage\": 70\n },\n {\n \"index\": 4,\n \"percentage\": 30\n }\n ]\n }\n ]\n },\n {\n \"index\": 2,\n \"provider_id\": \"ADYEN\",\n \"connection_id\": \"b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f\",\n \"output\": [\n {\n \"status\": \"APPROVED\",\n \"next\": 3\n }\n ]\n },\n {\n \"index\": 3,\n \"action\": \"CAPTURE\",\n \"action_delay\": \"PT5M\"\n },\n {\n \"index\": 4,\n \"action\": \"CANCEL\"\n }\n ]\n },\n \"condition_sets\": [\n {\n \"sort_number\": 1,\n \"name\": \"US & Canada\",\n \"conditions\": [\n {\n \"condition_type\": \"COUNTRY\",\n \"conditional\": \"ONE_OF\",\n \"values\": [\n \"US\",\n \"CA\"\n ]\n }\n ],\n \"route\": {\n \"steps\": [\n {\n \"index\": 1,\n \"action\": \"CANCEL\"\n }\n ]\n }\n }\n ]\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-Idempotency-Key", "<x-idempotency-key>")
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/routing/{routing_id}")
.header("X-Idempotency-Key", "<x-idempotency-key>")
.header("PUBLIC-API-KEY", "<api-key>")
.header("PRIVATE-SECRET-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"account_id\": \"7825fc5e-e50a-4248-9ae8-5d3786afb0be\",\n \"payment_method\": \"GOOGLE_PAY\",\n \"name\": \"Google Pay routing v2\",\n \"default_route\": {\n \"steps\": [\n {\n \"index\": 1,\n \"provider_id\": \"ADYEN\",\n \"connection_id\": \"b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f\",\n \"output\": [\n {\n \"status\": \"APPROVED\",\n \"next\": 3\n },\n {\n \"status\": \"DECLINED\",\n \"retry\": false,\n \"next_split\": [\n {\n \"index\": 2,\n \"percentage\": 70\n },\n {\n \"index\": 4,\n \"percentage\": 30\n }\n ]\n }\n ]\n },\n {\n \"index\": 2,\n \"provider_id\": \"ADYEN\",\n \"connection_id\": \"b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f\",\n \"output\": [\n {\n \"status\": \"APPROVED\",\n \"next\": 3\n }\n ]\n },\n {\n \"index\": 3,\n \"action\": \"CAPTURE\",\n \"action_delay\": \"PT5M\"\n },\n {\n \"index\": 4,\n \"action\": \"CANCEL\"\n }\n ]\n },\n \"condition_sets\": [\n {\n \"sort_number\": 1,\n \"name\": \"US & Canada\",\n \"conditions\": [\n {\n \"condition_type\": \"COUNTRY\",\n \"conditional\": \"ONE_OF\",\n \"values\": [\n \"US\",\n \"CA\"\n ]\n }\n ],\n \"route\": {\n \"steps\": [\n {\n \"index\": 1,\n \"action\": \"CANCEL\"\n }\n ]\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/routing/{routing_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-Idempotency-Key"] = '<x-idempotency-key>'
request["PUBLIC-API-KEY"] = '<api-key>'
request["PRIVATE-SECRET-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"account_id\": \"7825fc5e-e50a-4248-9ae8-5d3786afb0be\",\n \"payment_method\": \"GOOGLE_PAY\",\n \"name\": \"Google Pay routing v2\",\n \"default_route\": {\n \"steps\": [\n {\n \"index\": 1,\n \"provider_id\": \"ADYEN\",\n \"connection_id\": \"b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f\",\n \"output\": [\n {\n \"status\": \"APPROVED\",\n \"next\": 3\n },\n {\n \"status\": \"DECLINED\",\n \"retry\": false,\n \"next_split\": [\n {\n \"index\": 2,\n \"percentage\": 70\n },\n {\n \"index\": 4,\n \"percentage\": 30\n }\n ]\n }\n ]\n },\n {\n \"index\": 2,\n \"provider_id\": \"ADYEN\",\n \"connection_id\": \"b2c4d5e6-1a2b-4c3d-8e4f-5a6b7c8d9e0f\",\n \"output\": [\n {\n \"status\": \"APPROVED\",\n \"next\": 3\n }\n ]\n },\n {\n \"index\": 3,\n \"action\": \"CAPTURE\",\n \"action_delay\": \"PT5M\"\n },\n {\n \"index\": 4,\n \"action\": \"CANCEL\"\n }\n ]\n },\n \"condition_sets\": [\n {\n \"sort_number\": 1,\n \"name\": \"US & Canada\",\n \"conditions\": [\n {\n \"condition_type\": \"COUNTRY\",\n \"conditional\": \"ONE_OF\",\n \"values\": [\n \"US\",\n \"CA\"\n ]\n }\n ],\n \"route\": {\n \"steps\": [\n {\n \"index\": 1,\n \"action\": \"CANCEL\"\n }\n ]\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "8f2c1d3e-4b5a-4c7d-8e9f-0a1b2c3d4e5f",
"account_id": "acc-uuid",
"payment_method": "CARD",
"name": "Updated Card routing v2",
"default_route": {
"start_split": [
{
"index": 1,
"percentage": 45
}
],
"steps": [
{
"index": 1,
"provider_id": "STRIPE",
"connection_id": "f1a3c4d5-7b8e-4a2c-9d1e-3f4a5b6c7d8e",
"provider_type": "PAYMENT",
"timeout": 60,
"network_token_enable": true,
"network_token_on": true,
"three_d_secure_exemptions": [
"LOW_VALUE"
],
"action": "CANCEL",
"action_delay": "PT5M",
"output": [
{
"status": "DECLINED",
"decline_types": [
"<string>"
],
"group_id": 1044,
"group_name": "Soft declines",
"retry": false,
"next": 2,
"next_split": [
{
"index": 2,
"percentage": 70
}
]
}
],
"fraud": {
"rules": "rule-a,rule-b",
"blocklists": "<string>",
"allowlists": "<string>",
"reviewlists": "<string>",
"preset": "<string>",
"report_only": true
},
"smart_routing": {
"type": "LATENCY",
"providers": [
{
"provider_id": "ADYEN",
"connection_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"network_token_on": true
}
],
"no_retry_decline_types": [
"<string>"
],
"no_retry_decline_group_ids": [
5120
],
"no_retry_failure_causes": [
"<string>"
]
}
}
]
},
"condition_sets": [
{
"sort_number": 1,
"name": "Updated Card routing",
"description": "<string>",
"conditions": [
{
"condition_type": "COUNTRY",
"conditional": "ONE_OF",
"values": [
"US",
"CA"
],
"key": "<string>",
"item_values": [
"GC-50",
"GC-100",
"GC-200"
],
"currency": "USD",
"time_period_repeat_amount": 1,
"time_period_repeat_frequency": "DAILY",
"time_period_repetition_days": [
"MONDAY"
],
"time_period_start_time": "09:00:00",
"time_period_end_time": "18:00:00",
"timezone": "-03:00",
"limit_by": "PAYMENTS",
"payments_count": "ALL"
}
],
"route": {}
}
],
"created_at": "2026-05-12T14:30:00Z",
"updated_at": "2026-05-12T14:30:00Z"
}{
"code": "ROUTING_VALIDATION_FAILED",
"messages": [
"Validation failed for update"
]
}{
"code": "NOT_AUTHENTICATED",
"messages": [
"Not authenticated"
]
}{
"code": "ROUTING_NOT_FOUND",
"messages": [
"Routing '...' was not found"
]
}{
"code": "ROUTING_VERSION_CONFLICT",
"messages": [
"Another concurrent PATCH won the publish race"
]
}