支付方式(直接工作流)
将支付方式重新分配给其他客户
将已注册的支付方式重新分配给同一账户下的其他客户
PATCH
/
payment-methods
/
{payment_method_id}
将支付方式重新分配给另一位客户
curl --request PATCH \
--url https://api-sandbox.y.uno/v1/payment-methods/{payment_method_id} \
--header 'Content-Type: application/json' \
--header 'X-account-code: <x-account-code>' \
--header 'private-secret-key: <api-key>' \
--header 'public-api-key: <api-key>' \
--data '
{
"customer_id": "b3f2c1a0-1234-4a5b-9c8d-000000000001"
}
'import requests
url = "https://api-sandbox.y.uno/v1/payment-methods/{payment_method_id}"
payload = { "customer_id": "b3f2c1a0-1234-4a5b-9c8d-000000000001" }
headers = {
"X-account-code": "<x-account-code>",
"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-account-code': '<x-account-code>',
'public-api-key': '<api-key>',
'private-secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({customer_id: 'b3f2c1a0-1234-4a5b-9c8d-000000000001'})
};
fetch('https://api-sandbox.y.uno/v1/payment-methods/{payment_method_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/payment-methods/{payment_method_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([
'customer_id' => 'b3f2c1a0-1234-4a5b-9c8d-000000000001'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-account-code: <x-account-code>",
"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/payment-methods/{payment_method_id}"
payload := strings.NewReader("{\n \"customer_id\": \"b3f2c1a0-1234-4a5b-9c8d-000000000001\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-account-code", "<x-account-code>")
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/payment-methods/{payment_method_id}")
.header("X-account-code", "<x-account-code>")
.header("public-api-key", "<api-key>")
.header("private-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": \"b3f2c1a0-1234-4a5b-9c8d-000000000001\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/payment-methods/{payment_method_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-account-code"] = '<x-account-code>'
request["public-api-key"] = '<api-key>'
request["private-secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_id\": \"b3f2c1a0-1234-4a5b-9c8d-000000000001\"\n}"
response = http.request(request)
puts response.read_body{
"idempotency_key": "a0000000-0000-4000-8000-000000000010",
"name": "VISA ****1111",
"description": "VISA ****1111",
"type": "CARD",
"category": "CARD",
"country": "US",
"parent_type": null,
"status": "ENROLLED",
"sub_status": "ENROLLED",
"vaulted_token": "b0000000-0000-4000-8000-000000000002",
"callback_url": null,
"action": null,
"redirect_url": null,
"created_at": "2024-06-04T12:47:46.992602Z",
"updated_at": "2024-06-04T12:47:46.992603Z",
"card_data": {
"iin": "41111111",
"lfd": "1111",
"holder_name": "JOHN DOE",
"expiration_month": 3,
"expiration_year": 26,
"number_length": 16,
"security_code_length": 3,
"brand": "VISA",
"issuer": "JPMORGAN CHASE BANK N A",
"issuer_code": null,
"country_code": "US",
"category": "CREDIT",
"type": "CREDIT",
"fingerprint": "55a7fe38-cdc3-45dc-8c5f-820751799c76"
},
"last_successfully_used": null,
"last_successfully_used_at": null,
"preferred": null,
"customer_id": "b3f2c1a0-1234-4a5b-9c8d-000000000001",
"verify": null
}
将已注册的支付方式重新分配给同一账户下的其他客户。请在请求体中发送目标客户的
如果支付方式已分配给一个有数据的客户,则无法重新分配,请求会被拒绝并返回
customer_id。只有卡支付方式可以重新分配。响应返回的支付方式结构与注册支付方式响应相同,新的所有者显示在 customer_id 字段中。
要重新分配支付方式,您需要提供
payment_method_id,即使用注册支付方式 endpoint 时收到的 vaulted_token。409 CONFLICT。
支付方式重新分配后,商户负责在所有已使用该支付方式的地方更新客户标识符。这包括使用该支付方式创建的所有订阅、商户自身维护的用户与
vaulted_token 之间的映射,以及所有已存储的客户与支付方式组合。Yuno 会将支付方式重新分配给新客户,但不会更新商户端的这些引用。授权
路径参数
payment_method 的唯一标识符。该值是使用注册支付方式注册支付方式时收到的 vaulted_token(UUID)。
请求体
application/json
响应
已重新分配的支付方式,新的所有者位于 customer_id 字段中。
此页面对您有帮助吗?
⌘I
将支付方式重新分配给另一位客户
curl --request PATCH \
--url https://api-sandbox.y.uno/v1/payment-methods/{payment_method_id} \
--header 'Content-Type: application/json' \
--header 'X-account-code: <x-account-code>' \
--header 'private-secret-key: <api-key>' \
--header 'public-api-key: <api-key>' \
--data '
{
"customer_id": "b3f2c1a0-1234-4a5b-9c8d-000000000001"
}
'import requests
url = "https://api-sandbox.y.uno/v1/payment-methods/{payment_method_id}"
payload = { "customer_id": "b3f2c1a0-1234-4a5b-9c8d-000000000001" }
headers = {
"X-account-code": "<x-account-code>",
"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-account-code': '<x-account-code>',
'public-api-key': '<api-key>',
'private-secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({customer_id: 'b3f2c1a0-1234-4a5b-9c8d-000000000001'})
};
fetch('https://api-sandbox.y.uno/v1/payment-methods/{payment_method_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/payment-methods/{payment_method_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([
'customer_id' => 'b3f2c1a0-1234-4a5b-9c8d-000000000001'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-account-code: <x-account-code>",
"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/payment-methods/{payment_method_id}"
payload := strings.NewReader("{\n \"customer_id\": \"b3f2c1a0-1234-4a5b-9c8d-000000000001\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("X-account-code", "<x-account-code>")
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/payment-methods/{payment_method_id}")
.header("X-account-code", "<x-account-code>")
.header("public-api-key", "<api-key>")
.header("private-secret-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": \"b3f2c1a0-1234-4a5b-9c8d-000000000001\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v1/payment-methods/{payment_method_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["X-account-code"] = '<x-account-code>'
request["public-api-key"] = '<api-key>'
request["private-secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_id\": \"b3f2c1a0-1234-4a5b-9c8d-000000000001\"\n}"
response = http.request(request)
puts response.read_body{
"idempotency_key": "a0000000-0000-4000-8000-000000000010",
"name": "VISA ****1111",
"description": "VISA ****1111",
"type": "CARD",
"category": "CARD",
"country": "US",
"parent_type": null,
"status": "ENROLLED",
"sub_status": "ENROLLED",
"vaulted_token": "b0000000-0000-4000-8000-000000000002",
"callback_url": null,
"action": null,
"redirect_url": null,
"created_at": "2024-06-04T12:47:46.992602Z",
"updated_at": "2024-06-04T12:47:46.992603Z",
"card_data": {
"iin": "41111111",
"lfd": "1111",
"holder_name": "JOHN DOE",
"expiration_month": 3,
"expiration_year": 26,
"number_length": 16,
"security_code_length": 3,
"brand": "VISA",
"issuer": "JPMORGAN CHASE BANK N A",
"issuer_code": null,
"country_code": "US",
"category": "CREDIT",
"type": "CREDIT",
"fingerprint": "55a7fe38-cdc3-45dc-8c5f-820751799c76"
},
"last_successfully_used": null,
"last_successfully_used_at": null,
"preferred": null,
"customer_id": "b3f2c1a0-1234-4a5b-9c8d-000000000001",
"verify": null
}