AI resources
Refund order

This endpoint performs a full or partial refund of the transactions associated with an order. To perform a full refund, you must not send the amount to be refunded in the request body. To perform a partial refund you must indicate the amount to be refunded, along with the transaction ID you wish to return. In case of success, the request will return a response with status 201.

POST

https://api.mercadopago.com/v1/orders/{order_id}/refund
Request parameters
Header
Authorization
string

REQUIRED

Access Token obtained through the developer panel. Must be sent in all requests.
X-Idempotency-Key
string

REQUIRED

This function allows you to repeat requests safely, without the risk of carrying out the same action more than once by mistake. This is useful to avoid mistakes such as creating two identical payments. To ensure that eac
Path
order_id
string

REQUIRED

ID of the order that is being refunded. This value is returned in the response to the 'Create order' ("/v1/orders") request.
Body
transactions
array

REQUIRED

Contains information about the transactions associated with the order. It can contain only one transaction.
Response parameters
id
string
Identifier of the order being processed in the request.
status
string
Current status of the order.
processed: All transactions have been succesfully processed.
refunded: The order has been refunded.
status_detail
string
Details about payment status.
refunded: The order has been refunded.
partially_refunded: The order has been partially refunded.
transactions
object
Contains information about the transactions associated with the order.

Errors

Each API response includes an HTTP status code indicating the result of the request. Status code 200 indicates success, 400 indicates an error in the submitted data, and 500 indicates an internal server error.

Some 400 errors can be handled programmatically and include an error code that identifies the issue.

400Request error.

empty_required_header

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

invalid_idempotency_key_length

The value sent in the "X-Idempotency-Key" header exceeded the allowed size. The header accepts values between 1 and 64 characters.

invalid_path_param

The "order_id" provided in the request path is not correct. Please confirm it and provide a valid ID to try again.

refund_amount_exceeds

The requested refund amount is greater than the available amount.

404Not found.

order_not_found

Order not found. Please check if you provided the correct order ID.

transaction_not_found

Transaction not found. Please check if you provided the correct Transaction ID.

409Some specific system rule does not allow the action to be performed due to defined restrictions.

idempotency_key_already_used

The value sent as the idempotency header ("X-Idempotency-Key") has already been used. Please try the request again sending a new value.

order_already_refunded

Order already refunded.

cannot_refund_order

Cannot refund order. Please check if the order is already refunded.

order_refund_already_in_process

There is already a full refund request in process for the order in question.

429Request limit exceeded.

too_many_requests

"Client ID" blocked by the gateway because the request limit for the ID in question was reached. Read the "Retry-After" header from the response and wait the indicated number of seconds before retrying. For greater resilience, implement exponential backoff with jitter, that is, increase the wait time with each new attempt and add a random variation to avoid simultaneous retransmission of multiple requests.

usage_quota_exceeded

Quota enforced by the API backend because the per-client request limit was reached. Read the "Retry-After" header from the response and wait the indicated number of seconds before retrying. For greater resilience, implement exponential backoff with jitter, that is, increase the wait time with each new attempt and add a random variation to avoid simultaneous retransmission of multiple requests.

500Generic error.

idempotency_validation_failed

Validation fail. Please try submitting the request again.

internal_error

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 'Authorization: Bearer APP_USR-5*********956537-12*********ff1a3d36d*********47e7b9985*********770' \
       -H 'X-Idempotency-Key: a90bbcd9-da4c-4de7-959b-2c9cbb9bf55e' \
    -d '{
  "transactions": [
    {
      "id": "PAY01J67CQQH5904WDBVZEM4JMEP3",
      "amount": "24.50"
    }
  ]
}'
Response
{
  "id": "ORD01J49MMW3SSBK5PSV3DFR32959",
  "status": "processed",
  "status_detail": "refunded",
  "transactions": {
    "refunds": [
      {
        "id": "REF01J49MMW3SSBK5PSV3DFR32959",
        "transaction_id": "PAY01JEVQM06WDW16MAQ8B5SC0MSC",
        "reference_id": "01JEVQM899NWSQC4FYWWW7KTF9",
        "amount": "24.50",
        "status": "processed"
      }
    ]
  }
}