AI resources
Cancel a transaction

This endpoint allows you to cancel an eligible scheduled transaction using the payout_id and transaction_id returned when the payout was created. Only transactions that have not yet been processed and have status=pending or status=in_process can be canceled, and the cancellation is irreversible. The cancellation request must be sent at least 12 hours before the scheduled execution date and time. On success, the request returns 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

CONDITIONALLY 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

CONDITIONALLY REQUIRED

Value of type boolean indicating whether the integrator will 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 that contains the transaction you wish to cancel, returned in the id field of the response to POST /v1/payouts.
transaction_id
string

REQUIRED

Identifier of the transaction you wish to cancel, returned in the transactions[].id field of the response to POST /v1/payouts.
Body
comments
string
Clear justification for the cancellation (avoid including sensitive personal information). This field supports history and audit.
deleted_by
string
Unique identification of who performed the cancellation (user, system, etc.). This field supports 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.

invalid_account

The `account` object was sent without the data required to identify the destination account. Provide `email` for a Mercado Pago account or the required bank details for an external account, including `number` and `bank_id`. For a Pix transfer, set `transactions.type` to `pix` and send the key details in `transactions.pix` instead of `account`.

invalid_account_type

The account_type field was sent with an unsupported value. Accepted values are checking_account or savings.

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-8*********88776-122*********fc20dede6*********a497d7225*********64' \
       -H 'X-Idempotency-Key: 24631ea4-5e09-4da0-8f98-ac874251e768' \
       -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.