Cancel or Refund a Payment (two cards)
Cancels or refunds a whole two-card payment, or an amount spread across both cards, without a transaction id.
curl --request POST \
--url https://api-sandbox.y.uno/v2/payments/{payment_id}/cancel-or-refund \
--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 '
{
"description": "<string>",
"merchant_reference": "<string>",
"customer_payer": {
"first_name": "<string>",
"last_name": "<string>",
"date_of_birth": "<string>",
"email": "<string>",
"nationality": "<string>",
"document": {
"document_number": "<string>"
},
"phone": {
"country_code": "<string>",
"number": "<string>"
},
"billing_address": {
"address_line_1": "<string>",
"address_line_2": "<string>",
"city": "<string>",
"state": "<string>",
"zip_code": "<string>"
},
"shipping_address": {
"address_line_1": "<string>",
"address_line_2": "<string>",
"city": "<string>",
"state": "<string>",
"zip_code": "<string>"
}
},
"payment_method": {
"detail": {
"bank_transfer": {
"bank_name": "<string>",
"bank_id": "<string>",
"beneficiary_name": "<string>",
"bank_account": "<string>",
"beneficiary_document_type": "<string>",
"beneficiary_document": "<string>",
"reference": "<string>",
"bank_account_mask_number": "<string>",
"mandate": {
"id": "<string>",
"info": "<string>",
"received_status": "<string>",
"existing_status": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}
}
}
}
'import requests
url = "https://api-sandbox.y.uno/v2/payments/{payment_id}/cancel-or-refund"
payload = {
"description": "<string>",
"merchant_reference": "<string>",
"customer_payer": {
"first_name": "<string>",
"last_name": "<string>",
"date_of_birth": "<string>",
"email": "<string>",
"nationality": "<string>",
"document": { "document_number": "<string>" },
"phone": {
"country_code": "<string>",
"number": "<string>"
},
"billing_address": {
"address_line_1": "<string>",
"address_line_2": "<string>",
"city": "<string>",
"state": "<string>",
"zip_code": "<string>"
},
"shipping_address": {
"address_line_1": "<string>",
"address_line_2": "<string>",
"city": "<string>",
"state": "<string>",
"zip_code": "<string>"
}
},
"payment_method": { "detail": { "bank_transfer": {
"bank_name": "<string>",
"bank_id": "<string>",
"beneficiary_name": "<string>",
"bank_account": "<string>",
"beneficiary_document_type": "<string>",
"beneficiary_document": "<string>",
"reference": "<string>",
"bank_account_mask_number": "<string>",
"mandate": {
"id": "<string>",
"info": "<string>",
"received_status": "<string>",
"existing_status": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
} } }
}
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({
description: '<string>',
merchant_reference: '<string>',
customer_payer: {
first_name: '<string>',
last_name: '<string>',
date_of_birth: '<string>',
email: '<string>',
nationality: '<string>',
document: {document_number: '<string>'},
phone: {country_code: '<string>', number: '<string>'},
billing_address: {
address_line_1: '<string>',
address_line_2: '<string>',
city: '<string>',
state: '<string>',
zip_code: '<string>'
},
shipping_address: {
address_line_1: '<string>',
address_line_2: '<string>',
city: '<string>',
state: '<string>',
zip_code: '<string>'
}
},
payment_method: {
detail: {
bank_transfer: {
bank_name: '<string>',
bank_id: '<string>',
beneficiary_name: '<string>',
bank_account: '<string>',
beneficiary_document_type: '<string>',
beneficiary_document: '<string>',
reference: '<string>',
bank_account_mask_number: '<string>',
mandate: {
id: '<string>',
info: '<string>',
received_status: '<string>',
existing_status: '<string>',
created_at: '2023-11-07T05:31:56Z',
updated_at: '2023-11-07T05:31:56Z'
}
}
}
}
})
};
fetch('https://api-sandbox.y.uno/v2/payments/{payment_id}/cancel-or-refund', 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}/cancel-or-refund",
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([
'description' => '<string>',
'merchant_reference' => '<string>',
'customer_payer' => [
'first_name' => '<string>',
'last_name' => '<string>',
'date_of_birth' => '<string>',
'email' => '<string>',
'nationality' => '<string>',
'document' => [
'document_number' => '<string>'
],
'phone' => [
'country_code' => '<string>',
'number' => '<string>'
],
'billing_address' => [
'address_line_1' => '<string>',
'address_line_2' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zip_code' => '<string>'
],
'shipping_address' => [
'address_line_1' => '<string>',
'address_line_2' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zip_code' => '<string>'
]
],
'payment_method' => [
'detail' => [
'bank_transfer' => [
'bank_name' => '<string>',
'bank_id' => '<string>',
'beneficiary_name' => '<string>',
'bank_account' => '<string>',
'beneficiary_document_type' => '<string>',
'beneficiary_document' => '<string>',
'reference' => '<string>',
'bank_account_mask_number' => '<string>',
'mandate' => [
'id' => '<string>',
'info' => '<string>',
'received_status' => '<string>',
'existing_status' => '<string>',
'created_at' => '2023-11-07T05:31:56Z',
'updated_at' => '2023-11-07T05:31:56Z'
]
]
]
]
]),
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}/cancel-or-refund"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"merchant_reference\": \"<string>\",\n \"customer_payer\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"date_of_birth\": \"<string>\",\n \"email\": \"<string>\",\n \"nationality\": \"<string>\",\n \"document\": {\n \"document_number\": \"<string>\"\n },\n \"phone\": {\n \"country_code\": \"<string>\",\n \"number\": \"<string>\"\n },\n \"billing_address\": {\n \"address_line_1\": \"<string>\",\n \"address_line_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip_code\": \"<string>\"\n },\n \"shipping_address\": {\n \"address_line_1\": \"<string>\",\n \"address_line_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip_code\": \"<string>\"\n }\n },\n \"payment_method\": {\n \"detail\": {\n \"bank_transfer\": {\n \"bank_name\": \"<string>\",\n \"bank_id\": \"<string>\",\n \"beneficiary_name\": \"<string>\",\n \"bank_account\": \"<string>\",\n \"beneficiary_document_type\": \"<string>\",\n \"beneficiary_document\": \"<string>\",\n \"reference\": \"<string>\",\n \"bank_account_mask_number\": \"<string>\",\n \"mandate\": {\n \"id\": \"<string>\",\n \"info\": \"<string>\",\n \"received_status\": \"<string>\",\n \"existing_status\": \"<string>\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\"\n }\n }\n }\n }\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}/cancel-or-refund")
.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 \"description\": \"<string>\",\n \"merchant_reference\": \"<string>\",\n \"customer_payer\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"date_of_birth\": \"<string>\",\n \"email\": \"<string>\",\n \"nationality\": \"<string>\",\n \"document\": {\n \"document_number\": \"<string>\"\n },\n \"phone\": {\n \"country_code\": \"<string>\",\n \"number\": \"<string>\"\n },\n \"billing_address\": {\n \"address_line_1\": \"<string>\",\n \"address_line_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip_code\": \"<string>\"\n },\n \"shipping_address\": {\n \"address_line_1\": \"<string>\",\n \"address_line_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip_code\": \"<string>\"\n }\n },\n \"payment_method\": {\n \"detail\": {\n \"bank_transfer\": {\n \"bank_name\": \"<string>\",\n \"bank_id\": \"<string>\",\n \"beneficiary_name\": \"<string>\",\n \"bank_account\": \"<string>\",\n \"beneficiary_document_type\": \"<string>\",\n \"beneficiary_document\": \"<string>\",\n \"reference\": \"<string>\",\n \"bank_account_mask_number\": \"<string>\",\n \"mandate\": {\n \"id\": \"<string>\",\n \"info\": \"<string>\",\n \"received_status\": \"<string>\",\n \"existing_status\": \"<string>\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\"\n }\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v2/payments/{payment_id}/cancel-or-refund")
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 \"description\": \"<string>\",\n \"merchant_reference\": \"<string>\",\n \"customer_payer\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"date_of_birth\": \"<string>\",\n \"email\": \"<string>\",\n \"nationality\": \"<string>\",\n \"document\": {\n \"document_number\": \"<string>\"\n },\n \"phone\": {\n \"country_code\": \"<string>\",\n \"number\": \"<string>\"\n },\n \"billing_address\": {\n \"address_line_1\": \"<string>\",\n \"address_line_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip_code\": \"<string>\"\n },\n \"shipping_address\": {\n \"address_line_1\": \"<string>\",\n \"address_line_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip_code\": \"<string>\"\n }\n },\n \"payment_method\": {\n \"detail\": {\n \"bank_transfer\": {\n \"bank_name\": \"<string>\",\n \"bank_id\": \"<string>\",\n \"beneficiary_name\": \"<string>\",\n \"bank_account\": \"<string>\",\n \"beneficiary_document_type\": \"<string>\",\n \"beneficiary_document\": \"<string>\",\n \"reference\": \"<string>\",\n \"bank_account_mask_number\": \"<string>\",\n \"mandate\": {\n \"id\": \"<string>\",\n \"info\": \"<string>\",\n \"received_status\": \"<string>\",\n \"existing_status\": \"<string>\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\"\n }\n }\n }\n }\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": "REFUNDED",
"sub_status": "REFUNDED",
"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": true,
"account_updater": false,
"payment_methods": [
{
"sequence": 1,
"type": "CARD",
"amount": {
"currency": "BRL",
"value": 200
},
"transactions": [
{
"id": "d2a4f6b8-1c3e-4a5b-8d7f-9e0a1b2c3d4e",
"type": "PURCHASE",
"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": "b6e8d0f2-5a7c-4e9f-8b1d-3c4d5e6f7a8b",
"type": "REFUND",
"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": "PURCHASE",
"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"
},
{
"id": "d8a0f2b4-7c9e-4a1b-8d3f-5e6f7a8b9c0d",
"type": "REFUND",
"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"
]
}transaction_id is needed: Yuno cancels each card that is only authorized and refunds each card that was charged.
amount is optional. If you omit it, the whole payment is canceled or refunded. If you send it, Yuno spreads it across the cards, starting with the card that has the most refundable amount. An amount above the total refundable amount of the payment is rejected.201 with the payment in the v2 shape.
INVALID_STATUS.X-Idempotency-Key. See Authentication for details.Authorizations
Headers
Unique key for this request. Required on every v2 payment request. Retry an unclear outcome with the same key. Without it the request is rejected with 400 INVALID_PARAMETERS: "The header 'x-idempotency-key' is required."
Path Parameters
The id of the payment returned by POST /v2/payments.
Body
Reason for the operation. Possible values are DUPLICATE, FRAUDULENT and REQUESTED_BY_CUSTOMER.
DUPLICATE, FRAUDULENT, REQUESTED_BY_CUSTOMER Description of the cancellation or refund. (MAX 255; MIN 3).
Identification of the payment transaction defined by the merchant. If no merchant_reference is defined, the merchant_order_id of the payment will be associated to the transaction. (MAX 255; MIN 3).
Optional. Amount to refund across both cards, the card with the most refundable amount first. Above the total refundable amount, the request is rejected. If you omit it, the whole payment is canceled or refunded.
Show child attributes
Show child attributes
Specifies customer object for payments.
Show child attributes
Show child attributes
Specifies payment method object for payments.
Show child attributes
Show child attributes
Response
The payment after the operation, in the v2 shape
A payment funded by two cards.
Aggregated status of the payment. See Pay with two cards.
Aggregated sub status, for example APPROVED, AUTHORIZED, PARTIALLY_CAPTURED, PARTIALLY_REFUNDED, REFUND_RETRY_IN_PROCESS or CANCEL_RETRY_IN_PROCESS.
true for a payment funded by two cards.
Number of cards that fund the payment: 2.
true when the SDK must continue the payment, for example to run a 3DS challenge.
Total of the payment.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
The payer, as sent in the request.
DIRECT, REDIRECT, SDK_CHECKOUT Was this page helpful?
curl --request POST \
--url https://api-sandbox.y.uno/v2/payments/{payment_id}/cancel-or-refund \
--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 '
{
"description": "<string>",
"merchant_reference": "<string>",
"customer_payer": {
"first_name": "<string>",
"last_name": "<string>",
"date_of_birth": "<string>",
"email": "<string>",
"nationality": "<string>",
"document": {
"document_number": "<string>"
},
"phone": {
"country_code": "<string>",
"number": "<string>"
},
"billing_address": {
"address_line_1": "<string>",
"address_line_2": "<string>",
"city": "<string>",
"state": "<string>",
"zip_code": "<string>"
},
"shipping_address": {
"address_line_1": "<string>",
"address_line_2": "<string>",
"city": "<string>",
"state": "<string>",
"zip_code": "<string>"
}
},
"payment_method": {
"detail": {
"bank_transfer": {
"bank_name": "<string>",
"bank_id": "<string>",
"beneficiary_name": "<string>",
"bank_account": "<string>",
"beneficiary_document_type": "<string>",
"beneficiary_document": "<string>",
"reference": "<string>",
"bank_account_mask_number": "<string>",
"mandate": {
"id": "<string>",
"info": "<string>",
"received_status": "<string>",
"existing_status": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}
}
}
}
'import requests
url = "https://api-sandbox.y.uno/v2/payments/{payment_id}/cancel-or-refund"
payload = {
"description": "<string>",
"merchant_reference": "<string>",
"customer_payer": {
"first_name": "<string>",
"last_name": "<string>",
"date_of_birth": "<string>",
"email": "<string>",
"nationality": "<string>",
"document": { "document_number": "<string>" },
"phone": {
"country_code": "<string>",
"number": "<string>"
},
"billing_address": {
"address_line_1": "<string>",
"address_line_2": "<string>",
"city": "<string>",
"state": "<string>",
"zip_code": "<string>"
},
"shipping_address": {
"address_line_1": "<string>",
"address_line_2": "<string>",
"city": "<string>",
"state": "<string>",
"zip_code": "<string>"
}
},
"payment_method": { "detail": { "bank_transfer": {
"bank_name": "<string>",
"bank_id": "<string>",
"beneficiary_name": "<string>",
"bank_account": "<string>",
"beneficiary_document_type": "<string>",
"beneficiary_document": "<string>",
"reference": "<string>",
"bank_account_mask_number": "<string>",
"mandate": {
"id": "<string>",
"info": "<string>",
"received_status": "<string>",
"existing_status": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
} } }
}
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({
description: '<string>',
merchant_reference: '<string>',
customer_payer: {
first_name: '<string>',
last_name: '<string>',
date_of_birth: '<string>',
email: '<string>',
nationality: '<string>',
document: {document_number: '<string>'},
phone: {country_code: '<string>', number: '<string>'},
billing_address: {
address_line_1: '<string>',
address_line_2: '<string>',
city: '<string>',
state: '<string>',
zip_code: '<string>'
},
shipping_address: {
address_line_1: '<string>',
address_line_2: '<string>',
city: '<string>',
state: '<string>',
zip_code: '<string>'
}
},
payment_method: {
detail: {
bank_transfer: {
bank_name: '<string>',
bank_id: '<string>',
beneficiary_name: '<string>',
bank_account: '<string>',
beneficiary_document_type: '<string>',
beneficiary_document: '<string>',
reference: '<string>',
bank_account_mask_number: '<string>',
mandate: {
id: '<string>',
info: '<string>',
received_status: '<string>',
existing_status: '<string>',
created_at: '2023-11-07T05:31:56Z',
updated_at: '2023-11-07T05:31:56Z'
}
}
}
}
})
};
fetch('https://api-sandbox.y.uno/v2/payments/{payment_id}/cancel-or-refund', 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}/cancel-or-refund",
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([
'description' => '<string>',
'merchant_reference' => '<string>',
'customer_payer' => [
'first_name' => '<string>',
'last_name' => '<string>',
'date_of_birth' => '<string>',
'email' => '<string>',
'nationality' => '<string>',
'document' => [
'document_number' => '<string>'
],
'phone' => [
'country_code' => '<string>',
'number' => '<string>'
],
'billing_address' => [
'address_line_1' => '<string>',
'address_line_2' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zip_code' => '<string>'
],
'shipping_address' => [
'address_line_1' => '<string>',
'address_line_2' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zip_code' => '<string>'
]
],
'payment_method' => [
'detail' => [
'bank_transfer' => [
'bank_name' => '<string>',
'bank_id' => '<string>',
'beneficiary_name' => '<string>',
'bank_account' => '<string>',
'beneficiary_document_type' => '<string>',
'beneficiary_document' => '<string>',
'reference' => '<string>',
'bank_account_mask_number' => '<string>',
'mandate' => [
'id' => '<string>',
'info' => '<string>',
'received_status' => '<string>',
'existing_status' => '<string>',
'created_at' => '2023-11-07T05:31:56Z',
'updated_at' => '2023-11-07T05:31:56Z'
]
]
]
]
]),
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}/cancel-or-refund"
payload := strings.NewReader("{\n \"description\": \"<string>\",\n \"merchant_reference\": \"<string>\",\n \"customer_payer\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"date_of_birth\": \"<string>\",\n \"email\": \"<string>\",\n \"nationality\": \"<string>\",\n \"document\": {\n \"document_number\": \"<string>\"\n },\n \"phone\": {\n \"country_code\": \"<string>\",\n \"number\": \"<string>\"\n },\n \"billing_address\": {\n \"address_line_1\": \"<string>\",\n \"address_line_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip_code\": \"<string>\"\n },\n \"shipping_address\": {\n \"address_line_1\": \"<string>\",\n \"address_line_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip_code\": \"<string>\"\n }\n },\n \"payment_method\": {\n \"detail\": {\n \"bank_transfer\": {\n \"bank_name\": \"<string>\",\n \"bank_id\": \"<string>\",\n \"beneficiary_name\": \"<string>\",\n \"bank_account\": \"<string>\",\n \"beneficiary_document_type\": \"<string>\",\n \"beneficiary_document\": \"<string>\",\n \"reference\": \"<string>\",\n \"bank_account_mask_number\": \"<string>\",\n \"mandate\": {\n \"id\": \"<string>\",\n \"info\": \"<string>\",\n \"received_status\": \"<string>\",\n \"existing_status\": \"<string>\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\"\n }\n }\n }\n }\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}/cancel-or-refund")
.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 \"description\": \"<string>\",\n \"merchant_reference\": \"<string>\",\n \"customer_payer\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"date_of_birth\": \"<string>\",\n \"email\": \"<string>\",\n \"nationality\": \"<string>\",\n \"document\": {\n \"document_number\": \"<string>\"\n },\n \"phone\": {\n \"country_code\": \"<string>\",\n \"number\": \"<string>\"\n },\n \"billing_address\": {\n \"address_line_1\": \"<string>\",\n \"address_line_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip_code\": \"<string>\"\n },\n \"shipping_address\": {\n \"address_line_1\": \"<string>\",\n \"address_line_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip_code\": \"<string>\"\n }\n },\n \"payment_method\": {\n \"detail\": {\n \"bank_transfer\": {\n \"bank_name\": \"<string>\",\n \"bank_id\": \"<string>\",\n \"beneficiary_name\": \"<string>\",\n \"bank_account\": \"<string>\",\n \"beneficiary_document_type\": \"<string>\",\n \"beneficiary_document\": \"<string>\",\n \"reference\": \"<string>\",\n \"bank_account_mask_number\": \"<string>\",\n \"mandate\": {\n \"id\": \"<string>\",\n \"info\": \"<string>\",\n \"received_status\": \"<string>\",\n \"existing_status\": \"<string>\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\"\n }\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.y.uno/v2/payments/{payment_id}/cancel-or-refund")
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 \"description\": \"<string>\",\n \"merchant_reference\": \"<string>\",\n \"customer_payer\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"date_of_birth\": \"<string>\",\n \"email\": \"<string>\",\n \"nationality\": \"<string>\",\n \"document\": {\n \"document_number\": \"<string>\"\n },\n \"phone\": {\n \"country_code\": \"<string>\",\n \"number\": \"<string>\"\n },\n \"billing_address\": {\n \"address_line_1\": \"<string>\",\n \"address_line_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip_code\": \"<string>\"\n },\n \"shipping_address\": {\n \"address_line_1\": \"<string>\",\n \"address_line_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip_code\": \"<string>\"\n }\n },\n \"payment_method\": {\n \"detail\": {\n \"bank_transfer\": {\n \"bank_name\": \"<string>\",\n \"bank_id\": \"<string>\",\n \"beneficiary_name\": \"<string>\",\n \"bank_account\": \"<string>\",\n \"beneficiary_document_type\": \"<string>\",\n \"beneficiary_document\": \"<string>\",\n \"reference\": \"<string>\",\n \"bank_account_mask_number\": \"<string>\",\n \"mandate\": {\n \"id\": \"<string>\",\n \"info\": \"<string>\",\n \"received_status\": \"<string>\",\n \"existing_status\": \"<string>\",\n \"created_at\": \"2023-11-07T05:31:56Z\",\n \"updated_at\": \"2023-11-07T05:31:56Z\"\n }\n }\n }\n }\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": "REFUNDED",
"sub_status": "REFUNDED",
"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": true,
"account_updater": false,
"payment_methods": [
{
"sequence": 1,
"type": "CARD",
"amount": {
"currency": "BRL",
"value": 200
},
"transactions": [
{
"id": "d2a4f6b8-1c3e-4a5b-8d7f-9e0a1b2c3d4e",
"type": "PURCHASE",
"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": "b6e8d0f2-5a7c-4e9f-8b1d-3c4d5e6f7a8b",
"type": "REFUND",
"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": "PURCHASE",
"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"
},
{
"id": "d8a0f2b4-7c9e-4a1b-8d3f-5e6f7a8b9c0d",
"type": "REFUND",
"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"
]
}