AI resources
Cancel a transaction

This endpoint allows you to cancel a scheduled transaction using the reference ID obtained from its creation response. The cancellation is intended to allow the interruption of incorrect or undesired payment operations before financial settlement and is irreversible, in order to preserve operational integrity and ensure full traceability for auditing purposes. Only transactions that have not yet been processed ("pending" and "in_process") can be canceled. In case of success, the request will return a response with status 204.

PUT

https://api.mercadopago.com/v1/payouts/{payout_id}/transactions/{transaction_id}/cancel
Request parameters
Header
Authorization
string

REQUIRED

Access Token obtained through the developer panel. Must be sent in all requests.
X-Idempotency-Key
string

REQUIRED

This feature allows you to safely retry requests without the risk of accidentally performing the same action more than once. This is useful for avoiding errors, such as creating two identical transactions, for example. T
X-signature
string

REQUIRED

Request signature with the encrypted body in base 64 with the public and private keys of the integrator. It is required only in a productive environment.
X-enforce-signature
boolean
Boolean to indicate whether the integrator will or will not send the signature. It must be "false" for test environments, and "true" for production environments, when the signature is mandatory.
Path
payout_id
string

REQUIRED

Identifier of the payout for which you wish to consult the transaction, returned in the response to its creation within the "id" field
transaction_id
string

REQUIRED

Identifier of the transaction for which you wish to consult, returned in the response to its creation within the "id" field
Body
comments
string

REQUIRED

Clear justification for the cancellation (avoid including sensitive personal information). This field is fundamental for history and audit.
deleted_by
string

REQUIRED

Unique identification of who performed the cancellation (user, system, etc). This field is fundamental for history and audit.
Response parameters
Esta solicitação não tem resposta
Errors

400Bad request. The parameters sent are not valid.

invalid_payout_id

Invalid data was sent in the request body. The payout was not found. Try sending the request again, validating all fields.

invalid_transaction_id

Invalid data was sent in the request body. The transaction was not found. Try sending the request again, validating all fields.

invalid_signature

Invalid data was sent in the request body. Check if the secret was generated correctly and is registered with Mercado Pago. Also check if the body you are sending is the one that was encrypted.

idempotency_key_required

Invalid data was sent in the request body. The idempotency key ("idempotency_key") is missing. Try sending the request again, validating all fields.

401Error. Access Token not authorized.

invalid_token

The value sent as Access Token is incorrect. Please check and try again with the correct value.

403Forbidden. You don't have permissions to access this resource.

forbidden

No permission to access the resource.

404Error. Payout not found.

not_found

Payout not found. Please check if you provided the correct payout ID.

412Precondition not met. The status of the transaction does not allow cancellation.

precondition_failed

The status of the transaction does not allow its cancelation. Only transactions with "status=pending" or "status=in_process" can be canceled.

500Internal server error.

internal_server_error

An unexpected error occurred on the server. Try the request again.

502Bad gateway. Integration failure with an external service.

bad_gateway

An error occurred in the integration with an external service. Try the request again.

Request
curl -X PUT \
    'https://api.mercadopago.com/v1/payouts/{payout_id}/transactions/{transaction_id}/cancel'\
    -H 'Content-Type: application/json' \
       -H 'Authorization: Bearer APP_USR-1*********685765-12*********1b4332e5c*********e077d7679*********664' \
       -H 'X-Idempotency-Key: 5752fd35-0d1a-47bc-8efd-dc1087210b10' \
       -H 'X-signature: true' \
       -H 'X-enforce-signature: false' \
       -H 'X-test-token: false' \
    -d '{
  "comments": "delete because the payment was canceled",
  "deleted_by": "user_123"
}'
Response
// This request has not been responded to.