Refund order - QR Code - Mercado Pago Developers
Refund order

POST

https://api.mercadopago.com/v1/orders/{order_id}/refund
This endpoint allows to create a refund for all the transactions associated with an order for Mercado Pago QR Code. That is, the refund will be issued on the order, so all transactions will be returned. Additionally, only orders with "status=processed" can be refunded. In case of success, the request will return a response with status 201.
Request's parameters
PATH
order_id
string

REQUIRED

ID of the order that contains the associated payment transaction to be refunded. This value is returned in the response to the "Create order" request.
HEADER
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. To ensure that each request is unique, you must use an exclusive value in the header of each un...View more
Response parameters
id
string
Identifier of the order to be refunded, received in the response to its creation.
status
string
Current status of the order.
processed: The order continues with a payment in status "processed", which is what allows the refund to be issued. To check the status of the refund, run the "Get order by ID" request and confirm it in the "transactions.refunds.status" field, and enable your Webhooks notifications.
status_detail
string
The order continues with a payment with "accredited" status, which is what allows the refund to be issued. To check the status of the refund, run the "Get order by ID" request and confirm it in the "transactions.refunds....View more
transactions
object
Contains information about the transaction associated with the order.
Errors

400Error.

empty_required_header

The 'X-Idempotency-Key' header is required and was not sent. Make the requisition again including it.

invalid_path_param

The Order ID provided in the request path has has an invalid format. It must begin with the prefix "ORD" and be followed by 26 characters. Please confirm it and provide a valid ID to try again.

invalid_order_owner

Due to internal validations, you cannot process a refund for an order that you did not create.

in_store_payment_refund_order

The time limit for issuing a refund for the order has been exceeded. Please verify that you are within the 360 days period from the order creation date.

401Error.

unauthorized

The value sent as Access Token is incorrect. Please check and try again with the correct value.

404Error.

order_not_found

The value sent as Order ID does not correspond to a created order, therefore it could not be found. Please check and try again with the correct value.

409Error.

idempotency_key_already_used

The value sent as the idempotency header has already been used with a different request within the last 24 hours. Please try the request again sending a new value.

order_already_refunded

You are trying to return an order that has been already refunded. Verify if you have submitted the correct ID.

cannot_refund_order,

The status of the order does not allow its refund. Only orders with status 'processed' can be refunded.

500Error.

500

Generic error. Please try submitting the request again.

Request
curl -X POST \
    'https://api.mercadopago.com/v1/orders/{order_id}/refund'\
    -H 'Content-Type: application/json' \
       -H 'X-Idempotency-Key: 0d5020ed-1af6-469c-ae06-c3bec19954bb' \
       -H 'Authorization: Bearer TEST-4599*********755-11221*********d497ae962*********ecf8d85-1*********' \
    
Sample answer
{
  "id": "ORD0000ABCD222233334444555566",
  "status": "processed",
  "status_detail": "accredited",
  "transactions": {
    "refunds": [
      {
        "id": "REF01J67CQQH5904WDBVZEM1234D",
        "transaction_id": "PAY01J67CQQH5904WDBVZEM4JMEP3",
        "amount": "50.00",
        "status": "processing",
        "reference_id": "12345678"
      }
    ]
  }
}