Cashback and Cancellations - Account Management - Mercado Pago Developers
Developers
API Reference
Support
Sign in

    Home

    Getting started

    Online Payments

    Checkout Pro

    Checkout API

    Payment Link

    Subscriptions

    Marketplace

    Mobile Checkout

    Web Tokenize Checkout

    In person payments

    QR Code

    Mercado Pago Point

    Plugins and platforms

    WooCommerce

    Prestashop

    Magento 2

    Shopify

    VTEX

    Loja Integrada

    Nuvemshop

    iSet

    Linx Commerce

    Wix

    SDKs

    Notifications

    Webhooks

    IPN

    Account Management

    Reports

    Get payments

    Improves approval

    Chargeback Management

    Cashback and Cancellations

    Requirements to go to production

    Resources

    Localization

    Changelog

    Status

IN THIS PAGE

Suggest edit
Help us improve the documentation
Did you see wrong information and would you like us to explain something else or improve our manuals? Please leave your suggestions on GitHub.

Refunds and cancellations

There are different situations in which you may want to cancel a sale:

  • If the payment status is pending or in_process, it means that the buyer has not been charged yet, so you can make a cancellation.

  • If the payment status is approved, it means that the buyer was charged, so you can make a refund.

WARNING
Note that for payments with QR and POINT, you can only make refunds but not cancellations.

Cancellations

  • Cancellations can be made only with pending and in process transactions
  • It is important for offline payment methods
  • The expiration of a payment occurs after 30 days and the cancellation is automatic, is this case the final status of the payment is cancelled/expired

Only pending or in_process payments can be cancelled. As soon as you cancel them, they will no longer be approved and you will be able to release the stock pending confirmation.

Cancellations are mainly used with cash payments.

These payments do not expire automatically, so you need to cancel them.

To cancel, make the following request by submitting the status cancelled:

  • php
  • java
  • node
  • ruby
  • python
  • curl
          
<?php

  $payment = MercadoPago\Payment::find_by_id($payment_id);
  $payment->status = "cancelled";
  $payment->update();

?>

        
          
Payment payment = Payment.findById(paymentId);
payment.setStatus("cancelled");
payment.update();


        
          
mercadopago.payment.update({
  id: paymentId,
  status: "cancelled"
}).then().catch();


        
          
sdk = Mercadopago::SDK.new('ENV_ACCESS_TOKEN')
request = {
  status: 'cancelled'
}
result = sdk.payment.update(payment_id, request)

        
          
sdk = mercadopago.SDK("ENV_ACCESS_TOKEN")

payment_data = {
    "status": "cancelled"
}

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

        
          
curl -X PUT \
-H "Content-Type: application/json" \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-d '{"status":"cancelled"}' \
'https://api.mercadopago.com/v1/payments/:ID'

        

Response status code: 200 OK

Refunds

You can refund a payment within 180 days after it was approved.

You must have sufficient funds in your account in order to successfully refund the payment amount. Otherwise, you will get a 400 Bad Request error.

If the buyer made the payment with card, the amount will be refunded directly to the card.

If the payment was made by other means, the amount will be deposited in the buyer’s Mercado Pago account. If the buyer has no account, we will create one using the buyer’s e-mail address.

Issue a full refund

To issue a full refund, make the following request indicating the payment_id:

php

<?php

$payment = MercadoPago\Payment::find_by_id($payment_id);
$payment->refund();

?>

node

mercadopago.payment.refund(payment_id)
  .then(function (response) {
    //Process response...
  })
  .catch(function (error) {
    //Handle the error ...
  });

python

refund_response = sdk.refund().create(payment_id)
refund = refund_response["response"]

curl

curl -X POST \
-H "Content-Type: application/json" \
-H 'Authorization: Bearer ACCESS_TOKEN' \
'https://api.mercadopago.com/v1/payments/:ID/refunds'
Nota
El pago quedará con status en refunded.

Response status code: 201 Created

json

{
	"id": REFUND_ID,
	"payment_id": ID,
	"amount": 73.48,
	"metadata": {},
	"source": {
		"id": "130379930",
		"name": "Firstname Lastname",
		"type": "collector"
	},
	"date_created": "2014-12-11T11:26:40.537-04:00"
}

Issue a partial refund

You can issue up to 20 partial refunds for one single payment. Upon completion, the payment status will be approved with a status_detail in partially_refunded.

You must indicate the amount to be refunded.

  • php
  • java
  • node
  • ruby
  • python
  • curl
          
<?php
  $payment = MercadoPago\Payment::find_by_id(paymentId);
  $payment->refund(10.5);
?>

        
          
Payment payment = Payment.findById(paymentId);
payment.refund(10.5);

        
          
mercadopago.payment.refundPartial({ payment_id: id, amount: Number(amount) })
  .then(function (response) {
    //Process response...
  })
  .catch(function (error) {
    //Handle the error ...
  });

        
          
sdk = Mercadopago::SDK.new('ENV_ACCESS_TOKEN')
request = {
  amount: 10.5
}
result = sdk.refund.create(payment_id, request)

        
          
refund_data = {
  "amount": 10.5
}

refund_response = sdk.refund().create(payment_id, refund_data)
refund = refund_response["response"]

        
          
curl -X POST \
-H "Content-Type: application/json" \
-H 'Authorization: Bearer ACCESS_TOKEN' \
'https://api.mercadopago.com/v1/payments/:ID/refunds' \
-d '{"amount":10.5}'

        

Get the refunds made

You can view the refunds issued for a specific payment with the following request:

  • php
  • java
  • node
  • ruby
  • python
  • curl
          
<?php
  $payment = MercadoPago\Payment::find_by_id($payment_id);
  $refunds = $payment->refund();
?>

        
          
Payment payment = Payment.findById(paymentId);
ArrayList<Refund> refunds = payment.refund();

        
          
mercadopago.payment.refund(paymentId).then(function(data) {}
  //Do Stuff ..
});

        
          
sdk = Mercadopago::SDK.new('ENV_ACCESS_TOKEN')
result = sdk.refund.list(payment_id)
refunds = result[:response]

        
          
refunds_response = sdk.refund().list_all(payment_id)
refunds = refunds_response["response"]

        
          
curl -X GET \
-H "Content-Type: application/json" \
-H 'Authorization: Bearer ACCESS_TOKEN' \
'https://api.mercadopago.com/v1/payments/:ID'

        

Response:

json

{
    "id": PAYMENT_ID,
    ...

    "refunds": [
      {
        "id": 111,
        "payment_id": PAYMENT_ID,
        "amount": 16.98,
        "metadata": {
        },
        "source": {
            "id": "130379930",
            "name": "Firstname Lastname",
            "type": "collector"
        },
        "date_created": "2014-12-04T17:00:03.000-04:00",
        "unique_sequence_number": null
      }
    ]
}
Was this information helpful?

Copyright © 2021 MercadoPago.com Representações LTDA. / CNPJ n.º 10.573.521/0001-91 / Av. das Nações Unidas, nº 3.003, Bonfim, Osasco/SP - CEP 06233-903

Terms and conditionsHow we protect your privacy
Seller Central

Ao navegar neste site, você aceita os cookies que usamos para melhorar sua experiência. Mais informações.