双卡支付(v2)
取消支付(两张卡)
使用某张卡的交易 id,取消双卡支付中该卡的授权。
POST
/
payments
/
{payment_id}
/
transactions
/
{transaction_id}
/
cancel
取消支付(两张卡)
curl --request POST \
--url https://api-sandbox.y.uno/v2/payments/{payment_id}/transactions/{transaction_id}/cancel \
--header 'Content-Type: application/json' \
--header 'X-Idempotency-Key: <x-idempotency-key>' \
--header 'private-secret-key: <api-key>' \
--header 'public-api-key: <api-key>' \
--data '
{
"merchant_reference": "<string>",
"description": "<string>"
}
'import requests
url = "https://api-sandbox.y.uno/v2/payments/{payment_id}/transactions/{transaction_id}/cancel"
payload = {
"merchant_reference": "<string>",
"description": "<string>"
}
headers = {
"X-Idempotency-Key": "<x-idempotency-key>",
"public-api-key": "<api-key>",
"private-secret-key": "<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>',
'public-api-key': '<api-key>',
'private-secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({merchant_reference: '<string>', description: '<string>'})
};
fetch('https://api-sandbox.y.uno/v2/payments/{payment_id}/transactions/{transaction_id}/cancel', 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/v2/payments/{payment_id}/transactions/{transaction_id}/cancel",
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([
'merchant_reference' => '<string>',
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Idempotency-Key: <x-idempotency-key>",
"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/v2/payments/{payment_id}/transactions/{transaction_id}/cancel"
payload := strings.NewReader("{\n \"merchant_reference\": \"<string>\",\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api-sandbox.y.uno/v2/payments/{payment_id}/transactions/{transaction_id}/cancel")
.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 \"merchant_reference\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v2/payments/{payment_id}/transactions/{transaction_id}/cancel")
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["public-api-key"] = '<api-key>'
request["private-secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"merchant_reference\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "7c1b6e2a-5f3d-4a8e-9b21-3e4f5a6b7c8d",
"account_id": "493e9374-510a-4201-9e09-de669d75f256",
"description": "Order paid with two cards",
"country": "BR",
"status": "CANCELED",
"sub_status": "CANCELED",
"merchant_order_id": "order-10045",
"created_at": "2026-10-27T14:02:11.120Z",
"updated_at": "2026-10-27T14:02:12.300Z",
"split_payment_methods": true,
"payment_methods_count": 2,
"sdk_action_required": false,
"amount": {
"currency": "BRL",
"value": 300
},
"checkout": {
"session": null
},
"payment_method": {
"capture": false,
"account_updater": false,
"payment_methods": [
{
"sequence": 1,
"type": "CARD",
"amount": {
"currency": "BRL",
"value": 200
},
"transactions": [
{
"id": "d2a4f6b8-1c3e-4a5b-8d7f-9e0a1b2c3d4e",
"type": "AUTHORIZE",
"status": "SUCCEEDED",
"category": "CARD",
"amount": 200,
"provider_id": "YUNO_TEST_PAYMENT_GATEWAY",
"response_code": "SUCCEEDED",
"response_message": "Transaction successful",
"reason": null,
"description": null,
"merchant_reference": null,
"three_d_secure_action_required": false,
"created_at": "2026-10-27T14:02:11.402Z",
"updated_at": "2026-10-27T14:02:12.118Z"
},
{
"id": "c7f9e1a3-6b8d-4f0a-9c2e-4d5e6f7a8b9c",
"type": "CANCEL",
"status": "SUCCEEDED",
"category": "CARD",
"amount": 200,
"provider_id": "YUNO_TEST_PAYMENT_GATEWAY",
"response_code": "SUCCEEDED",
"response_message": "Transaction successful",
"reason": null,
"description": null,
"merchant_reference": null,
"three_d_secure_action_required": false,
"created_at": "2026-10-27T14:02:11.402Z",
"updated_at": "2026-10-27T14:02:12.118Z"
}
]
},
{
"sequence": 2,
"type": "CARD",
"amount": {
"currency": "BRL",
"value": 100
},
"transactions": [
{
"id": "e3b5a7c9-2d4f-4b6c-9e8a-0f1b2c3d4e5f",
"type": "AUTHORIZE",
"status": "SUCCEEDED",
"category": "CARD",
"amount": 100,
"provider_id": "YUNO_TEST_PAYMENT_GATEWAY",
"response_code": "SUCCEEDED",
"response_message": "Transaction successful",
"reason": null,
"description": null,
"merchant_reference": null,
"three_d_secure_action_required": false,
"created_at": "2026-10-27T14:02:11.402Z",
"updated_at": "2026-10-27T14:02:12.118Z"
}
]
}
]
},
"customer_payer": {
"id": "cfae0941-7234-427a-a739-ef4fce966c79",
"first_name": "Ana",
"last_name": "Souza",
"email": "ana.souza@example.com"
},
"workflow": "DIRECT",
"callback_url": "https://merchant.example.com/checkout/return",
"metadata": []
}{
"code": "INVALID_PARAMETERS",
"messages": [
"The header 'x-idempotency-key' is required."
]
}{
"code": "INVALID_CREDENTIALS",
"messages": [
"Invalid credentials"
]
}此请求取消通过创建支付(两张卡)创建的支付中一张已授权的卡。取消按卡进行:请发送来自
此请求需要
payment_method.payment_methods[].transactions 的该卡 AUTHORIZE 交易的 id。如需在一个请求中取消整笔支付,请使用取消或退款支付(两张卡)。
响应为 201,支付采用 v2 结构。
当支付处于
REFUND_RETRY_IN_PROCESS 或 CANCEL_RETRY_IN_PROCESS 状态时,取消会被拒绝。请参阅使用两张卡支付。X-Idempotency-Key。详情请参阅身份验证。此页面对您有帮助吗?
⌘I
取消支付(两张卡)
curl --request POST \
--url https://api-sandbox.y.uno/v2/payments/{payment_id}/transactions/{transaction_id}/cancel \
--header 'Content-Type: application/json' \
--header 'X-Idempotency-Key: <x-idempotency-key>' \
--header 'private-secret-key: <api-key>' \
--header 'public-api-key: <api-key>' \
--data '
{
"merchant_reference": "<string>",
"description": "<string>"
}
'import requests
url = "https://api-sandbox.y.uno/v2/payments/{payment_id}/transactions/{transaction_id}/cancel"
payload = {
"merchant_reference": "<string>",
"description": "<string>"
}
headers = {
"X-Idempotency-Key": "<x-idempotency-key>",
"public-api-key": "<api-key>",
"private-secret-key": "<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>',
'public-api-key': '<api-key>',
'private-secret-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({merchant_reference: '<string>', description: '<string>'})
};
fetch('https://api-sandbox.y.uno/v2/payments/{payment_id}/transactions/{transaction_id}/cancel', 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/v2/payments/{payment_id}/transactions/{transaction_id}/cancel",
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([
'merchant_reference' => '<string>',
'description' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Idempotency-Key: <x-idempotency-key>",
"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/v2/payments/{payment_id}/transactions/{transaction_id}/cancel"
payload := strings.NewReader("{\n \"merchant_reference\": \"<string>\",\n \"description\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", 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.post("https://api-sandbox.y.uno/v2/payments/{payment_id}/transactions/{transaction_id}/cancel")
.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 \"merchant_reference\": \"<string>\",\n \"description\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v2/payments/{payment_id}/transactions/{transaction_id}/cancel")
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["public-api-key"] = '<api-key>'
request["private-secret-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"merchant_reference\": \"<string>\",\n \"description\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "7c1b6e2a-5f3d-4a8e-9b21-3e4f5a6b7c8d",
"account_id": "493e9374-510a-4201-9e09-de669d75f256",
"description": "Order paid with two cards",
"country": "BR",
"status": "CANCELED",
"sub_status": "CANCELED",
"merchant_order_id": "order-10045",
"created_at": "2026-10-27T14:02:11.120Z",
"updated_at": "2026-10-27T14:02:12.300Z",
"split_payment_methods": true,
"payment_methods_count": 2,
"sdk_action_required": false,
"amount": {
"currency": "BRL",
"value": 300
},
"checkout": {
"session": null
},
"payment_method": {
"capture": false,
"account_updater": false,
"payment_methods": [
{
"sequence": 1,
"type": "CARD",
"amount": {
"currency": "BRL",
"value": 200
},
"transactions": [
{
"id": "d2a4f6b8-1c3e-4a5b-8d7f-9e0a1b2c3d4e",
"type": "AUTHORIZE",
"status": "SUCCEEDED",
"category": "CARD",
"amount": 200,
"provider_id": "YUNO_TEST_PAYMENT_GATEWAY",
"response_code": "SUCCEEDED",
"response_message": "Transaction successful",
"reason": null,
"description": null,
"merchant_reference": null,
"three_d_secure_action_required": false,
"created_at": "2026-10-27T14:02:11.402Z",
"updated_at": "2026-10-27T14:02:12.118Z"
},
{
"id": "c7f9e1a3-6b8d-4f0a-9c2e-4d5e6f7a8b9c",
"type": "CANCEL",
"status": "SUCCEEDED",
"category": "CARD",
"amount": 200,
"provider_id": "YUNO_TEST_PAYMENT_GATEWAY",
"response_code": "SUCCEEDED",
"response_message": "Transaction successful",
"reason": null,
"description": null,
"merchant_reference": null,
"three_d_secure_action_required": false,
"created_at": "2026-10-27T14:02:11.402Z",
"updated_at": "2026-10-27T14:02:12.118Z"
}
]
},
{
"sequence": 2,
"type": "CARD",
"amount": {
"currency": "BRL",
"value": 100
},
"transactions": [
{
"id": "e3b5a7c9-2d4f-4b6c-9e8a-0f1b2c3d4e5f",
"type": "AUTHORIZE",
"status": "SUCCEEDED",
"category": "CARD",
"amount": 100,
"provider_id": "YUNO_TEST_PAYMENT_GATEWAY",
"response_code": "SUCCEEDED",
"response_message": "Transaction successful",
"reason": null,
"description": null,
"merchant_reference": null,
"three_d_secure_action_required": false,
"created_at": "2026-10-27T14:02:11.402Z",
"updated_at": "2026-10-27T14:02:12.118Z"
}
]
}
]
},
"customer_payer": {
"id": "cfae0941-7234-427a-a739-ef4fce966c79",
"first_name": "Ana",
"last_name": "Souza",
"email": "ana.souza@example.com"
},
"workflow": "DIRECT",
"callback_url": "https://merchant.example.com/checkout/return",
"metadata": []
}{
"code": "INVALID_PARAMETERS",
"messages": [
"The header 'x-idempotency-key' is required."
]
}{
"code": "INVALID_CREDENTIALS",
"messages": [
"Invalid credentials"
]
}