Cancel reserve - Payment management - Mercado Pago Developers
Which documentation are you looking for?

Do not know how to start integrating? 

Check the first steps

Cancel reserve

Cancellation of a reserve occurs when, for some reason, the payment for a purchase is not approved and the reservation amount needs to return to the customer's card limit or when a buyer withdraws from the purchase. For more information about refunds and cancellations of payments, see the section Refunds and Cancellations.

To cancel a reserve, use one of our available codes below.

  use MercadoPago\Client\Payment\PaymentClient;


  $client = new PaymentClient();
  $request_options = new RequestOptions();
  $request_options->setCustomHeaders(["X-Idempotency-Key: <SOME_UNIQUE_VALUE>"]);

  $payment = $client->cancel($payment_id, $request_options);
  echo $payment->status;


Long paymentId = 123456789L;

Map<String, String> customHeaders = new HashMap<>();
    customHeaders.put("x-idempotency-key", <SOME_UNIQUE_VALUE>);
MPRequestOptions requestOptions = MPRequestOptions.builder()

PaymentClient client = new PaymentClient();
client.cancel(paymentId, requestOptions);

import { MercadoPagoConfig, Payment } from 'mercadopago';

const client = new MercadoPagoConfig({ accessToken: 'YOUR_ACCESS_TOKEN' });
const payment = new Payment(client);

id: '<PAYMENT_ID>',
requestOptions: {
idempotencyKey: '<IDEMPOTENCY_KEY>'

require 'mercadopago'
sdk =

custom_headers = {
 'x-idempotency-key': '<SOME_UNIQUE_VALUE>'

custom_request_options = custom_headers)

request = {
  status: 'canceled'

payment_response = sdk.payment.update(payment_id, request, custom_request_options)
payment = payment_response[:response]

using MercadoPago.Client.Payment;
using MercadoPago.Config;
using MercadoPago.Resource.Payment;

MercadoPagoConfig.AccessToken = "ENV_ACCESS_TOKEN";

var requestOptions = new RequestOptions();
requestOptions.CustomHeaders.Add("x-idempotency-key", "<SOME_UNIQUE_VALUE>");

var client = new PaymentClient();
Payment payment = await client.CancelAsync(paymentId, requestOptions);

import mercadopago
sdk = mercadopago.SDK("ENV_ACCESS_TOKEN")

request_options = mercadopago.config.RequestOptions()
request_options.custom_headers = {
    'x-idempotency-key': '<SOME_UNIQUE_VALUE>'

payment_data = {
  "status": "cancelled"

payment_response = sdk.payment().update(payment_id, payment_data, request_options)
payment = payment_response["response"]

curl -X PUT \
  '' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer ENV_ACCESS_TOKEN' \
  -H 'X-Idempotency-Key: SOME_UNIQUE_VALUE' \
  -d '{"status": "cancelled"}'


The response will show the following result:


"status": "cancelled",
"status_detail": "by_collector",
"captured": false,