MercadoPago Refunds and Cancellations for Basic Checkout

Unofficial Content

Refunds

MercadoPago provides an API to make refunds. There are two types of refund: Full Refund (the payment is completely refunded), or Partial Refund (part of the payment is refunded).

See the Web Panel RefundsBasic under Sample folder for more details about the following code.

Full Refund

To make a full refund, you will need the Collection's Id.

Event 'FullRefund'
    MercadoPago.PaymentBasicCheckout.FullRefund(&PaymentId,&CollectionInfoSDT,&Message,&ErrorCode)
    &ResponsePaymentInfo = &CollectionInfoSDT.ToXml()
    if &ErrorCode = 0
        //Success
    else
        Msg(&Message.Description)
    endif
Endevent

&CollectionInfoSDT is CollectionInfoSDT data type, which is used to receive information about the refund.
&Message contains a description in case an error occurs.

Partial Refund

To make a partial refund, you will need the Collection's Id and the amount that is going to be refunded.
Note: That amount cannot be greater than the payment's total cost.

Event 'PartialRefund'
    MercadoPago.PaymentBasicCheckout.PartialRefund(&PaymentId,&refundAmount,&RefundBasicSDT,&Message,&ErrorCode)
    &ResponsePaymentInfo = &RefundBasicSDT.ToXml()
    if &ErrorCode = 0
        //Success
    else
        Msg(&Message.Description)
    endif
EndEvent

&RefundBasicSDT is RefundBasicSDT data type, which is used to receive information about the refund.
&Message contains a description in case an error occurs.
&refundAmount is the amount to be refunded.

Restrictions

  • You must have enough available money in your account so you can refund the payment amount successfully. Otherwise, you'll get a 400 Bad Request error.
  • You can refund a payment within 90 days after it was accredited.
  • You can only refund payments made with cards.
  • You can only refund approved payments.
  • You can perform up to 20 partial refunds in one payment.
  • By now, it is not possible to perform partial refunds of payments made to MercadoLibre articles (marketplace=MELI).
  • By now, it is not possible to perform partial refunds of payments made with Brazilian MercadoLibre card (payment_method_id=melicard).
  • By now, it is not possible to perform partial refunds of recurring payments in Argentina (operation_type=recurring_payment).

Behavior

  • The payment status will be approved:partially_refunded until it is refunded. Just then the status will change to refunded
  • The refund of payments made with credit card will be reimbursed in the card statement.
  • All fees and taxes will be refunded partially in a proportional way.

Cancellation

To cancel a payment, you will need the Payment's Id.

Event 'CancelPayment'
    MercadoPago.PaymentBasicCheckout.CancelPayment(&PaymentId,&CollectionInfoSDT,&Message,&ErrorCode)
    &ResponsePaymentInfo = &CollectionInfoSDT.ToXml()
    if &ErrorCode = 0
        //Success
        msg(Format('-Cancelation operation status:%1', &CollectionInfoSDT.status))
    else
        Msg(&Message.Description)
    endif
Endevent

&CollectionInfoSDT is used to receive the payment's new status, where you can confirm the cancellation was made successfully.

Remarks

  • Only pending or in_process payments can be canceled.
  • Cancelled coupon payments, deposits, and transfers will be deposited in the buyer’s MercadoPago account.