改收款人的备注名 / 收藏(只能改这两项)
代会员调用 · 必带
x-on-behalf-of
收款人主体(银行、账号、户名)是平台级共享实体,主键是这几项算出来的指纹 —— 改账号就是另一个收款人,原地改会让所有关联到它的会员、以及已完成订单里的收款方快照跟着变。
所以银行信息不提供编辑:要改就新建一条。能改的只有落在关联表上的私有昵称与收藏位。
请把「编辑收款人」呈现成「重命名」,别在界面上摆一个改不了的表单。
两项都可选:只传 nickname 就只改名,只传 favorite 就只改收藏。一个字段都不传是 400 —— 那多半是键名拼错了,静默返回 200 会让你以为改成功了。
nickname 空串合法(清掉备注名),上限 64 字符。favorite 影响 GET /v1/remit/payees 的排序(收藏的置顶)。
路径参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
id |
string | 必填 | 收款人 id。带不带 pye_ 前缀都收。 |
请求头
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
x-on-behalf-of |
string | 必填 |
请求体
这个 operation 还没有在 spec 里声明请求体字段。
响应
200已更新
{
"id": "pye_1043",
"nickname": "房东",
"favorite": true
}400
invalid_fields 一个可改字段都没传404
not_found —— 收款人不存在、不是这个会员的、或已解绑。
三种同一响应。请求
curl -X PATCH 'https://api.zise.com/v1/remit/payees/{id}' \
-H 'x-auth-token: Bearer $TOKEN' \
-H 'x-on-behalf-of: $MEMBER_ID' \
-H 'content-type: application/json' \
-d '{
"nickname": "房东",
"favorite": true
}'const res = await fetch("https://api.zise.com/v1/remit/payees/{id}", {
method: "PATCH",
headers: {
"x-auth-token": "Bearer $TOKEN",
"x-on-behalf-of": "$MEMBER_ID",
"content-type": "application/json",
},
body: JSON.stringify({
"nickname": "房东",
"favorite": true
}),
});
// 金额按字符串读,别让它变成 number
const data = await res.json();import requests
res = requests.patch(
"https://api.zise.com/v1/remit/payees/{id}",
headers={
"x-auth-token": "Bearer $TOKEN",
"x-on-behalf-of": "$MEMBER_ID",
"content-type": "application/json",
},
json={
"nickname": "房东",
"favorite": true
},
)
# 金额用 Decimal(str(...)),不要 float
data = res.json()req, _ := http.NewRequest("PATCH", "https://api.zise.com/v1/remit/payees/{id}",
strings.NewReader(`{
"nickname": "房东",
"favorite": true
}`))
req.Header.Set("x-auth-token", "Bearer $TOKEN")
req.Header.Set("x-on-behalf-of", "$MEMBER_ID")
req.Header.Set("content-type", "application/json")
res, err := http.DefaultClient.Do(req)
// 金额字段用 string 接,不要 float64HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://api.zise.com/v1/remit/payees/{id}"))
.header("x-auth-token", "Bearer $TOKEN")
.header("x-on-behalf-of", "$MEMBER_ID")
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("""
{
"nickname": "房东",
"favorite": true
}
"""))
.build();
// 金额字段用 String / BigDecimal,不要 double$ch = curl_init('https://api.zise.com/v1/remit/payees/{id}');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'x-auth-token: Bearer $TOKEN',
'x-on-behalf-of: $MEMBER_ID',
'content-type: application/json',
],
CURLOPT_POSTFIELDS => <<<'JSON'
{
"nickname": "房东",
"favorite": true
}
JSON,
]);
$res = curl_exec($ch);
// 金额用 bcmath / 字符串,不要 floatval
200
{
"id": "pye_1043",
"nickname": "房东",
"favorite": true
}