Skip to main content
POST
/
v1
/
payments
/
{payment_id}
/
cancel-or-refund
Cancel or refund payment
curl --request POST \
  --url https://api-sandbox.y.uno/v1/payments/{payment_id}/cancel-or-refund \
  --header 'Content-Type: application/json' \
  --header 'account-code: <api-key>' \
  --header 'private-secret-key: <api-key>' \
  --header 'public-api-key: <api-key>' \
  --data '
{
  "amount": {
    "currency": "BRL",
    "value": 50
  },
  "reason": "Customer request"
}
'
{
  "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
  "checkout_session": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "SUCCEEDED",
  "amount": {
    "currency": "BRL",
    "value": 150
  },
  "country": "BR",
  "payment_method": {
    "type": "CARD"
  },
  "provider": {
    "name": "stripe_connect",
    "transaction_id": "pi_3abc123def456"
  },
  "merchant_order_id": "order-20260301-001",
  "customer_id": "cust_9a8b7c6d-5e4f-3210-abcd-ef0987654321",
  "transactions": [
    {
      "id": "txn_1a2b3c4d-5e6f-7890-abcd-ef1234567890",
      "status": "APPROVED",
      "provider": "stripe_connect",
      "provider_transaction_id": "pi_3abc123def456",
      "response_code": "00",
      "response_message": "Approved",
      "created_at": "2026-03-01T14:31:01.000Z"
    }
  ],
  "refunds": [],
  "three_ds": {
    "version": "2.2",
    "eci": "05",
    "status": "AUTHENTICATED"
  },
  "metadata": {
    "order_source": "web",
    "campaign": "spring-2026"
  },
  "installments": null,
  "failure_reason": null,
  "created_at": "2026-03-01T14:31:00.000Z",
  "updated_at": "2026-03-01T14:31:02.000Z"
}
Do not execute a refund while another is in progress. Wait for the current operation to complete before starting a new one.
This service allows you to cancel or refund an existing payment. Our system will identify if a cancellation or a refund is necessary based on the payment, no transaction_id is needed in this case. This service performs the following functions based on the status of the transaction:
  • Cancels the payment if it has not been captured.
  • Refunds the payment if it has been captured.
RefundsIf you fill out the amount field, the refund will be partial. Otherwise, it will create a complete refund. The funds will be refunded to the payment method that was originally charged.
Note that this request requires an X-Idempotency-Key. Check the Authentication page for more information.

Authorizations

public-api-key
string
header
required

Your public API key from the Yuno Dashboard

private-secret-key
string
header
required

Your private secret key (server-side only)

account-code
string
header
required

Your account identifier. The alias X-Account-Code is also accepted.

Path Parameters

payment_id
string<uuid>
required

The unique identifier of the payment

Body

application/json
amount
object

Amount to refund. Omit for full cancellation/refund.

Example:
{ "currency": "BRL", "value": 100 }
reason
string

Reason for the cancellation or refund

Response

Payment cancelled or refunded successfully

id
string<uuid>

Unique payment identifier

Example:

"f47ac10b-58cc-4372-a567-0e02b2c3d479"

checkout_session
string<uuid>
Example:

"a1b2c3d4-e5f6-7890-abcd-ef1234567890"

status
enum<string>

Current payment status

Available options:
SUCCEEDED,
PENDING,
DECLINED,
REJECTED,
CANCELLED,
REFUNDED,
PARTIALLY_REFUNDED,
AUTHORIZED
Example:

"SUCCEEDED"

amount
object
Example:
{ "currency": "BRL", "value": 100 }
country
string
Example:

"BR"

payment_method
object
provider
object
merchant_order_id
string
Example:

"order-20260301-001"

created_at
string<date-time>
Example:

"2026-03-01T14:31:00.000Z"

updated_at
string<date-time>
Example:

"2026-03-01T14:31:02.000Z"

transactions
object[]

Individual processing attempts for this payment

refunds
object[]

Refund records associated with this payment

three_ds
object

3DS authentication details, present for card payments

metadata
object

Custom key-value pairs set by the merchant

failure_reason
object

Decline details when status is DECLINED or REJECTED

customer_id
string<uuid>

ID of the associated customer record

installments
object

Installment details if payment was split into installments