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).
To make a full refund, you will need the Payment's Id.
Event 'FullRefund'
MercadoPago.PaymentCustomCheckout.FullRefund(&PaymentId,&RefundSDT,&Message,&ErrorCode)
&ResponsePaymentInfo = &RefundSDT.ToXml()
if &ErrorCode = 0
//Success
else
Msg(&Message.Description)
endif
Endevent
&RefundSDT is RefundSDT data type, which is used to receive information about the refund.
&Message contains a description in case an error occurs.
To make a partial refund, you will need the Payment'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.PaymentCustomCheckout.PartialRefund(&PaymentId,&refundAmount,&RefundSDT,&Message,&ErrorCode)
&ResponsePaymentInfo = &RefundSDT.ToXml()
if &ErrorCode = 0
//Success
else
Msg(&Message.Description)
endif
EndEvent
&RefundSDT is RefundSDT 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.
To cancel a payment, you will need the Payment's Id.
Event 'CancelPayment'
MercadoPago.PaymentCustomCheckout.CancelPayment(&PaymentId,&PaymentInfoSDT,&Message,&ErrorCode)
&ResponsePaymentInfo = &PaymentInfoSDT.ToXml()
if &ErrorCode = 0
//Success
else
Msg(&Message.Description)
endif
Endevent
&PaymentInfoSDT is used to receive the payment's new status, where you can confirm the cancellation was made successfully.
- Only
pending
or in_process
payments can be canceled.
- Cancelled coupon payments, deposits, and transfers will be deposited in the buyer’s MercadoPago account.