# 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** `/v1/orders/{order_id}/refund` ## Request parameters ### Header - `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 each request is unique, it is important to use a unique value in your request header. We suggest using a V4 UUID or random strings. ### 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. - `transactions` (array, optional) Contains information about the transactions associated with the order. It can contain only one transaction. - `transactions[].id` (string, optional) Identifier of the payment transaction created in the request, automatically generated by Mercado Pago. - `transactions[].amount` (string, optional) Transaction amount. If only one payment method is used, it must be equivalent to the amount entered in the "total_amount" field. If two are used, it is the sum between the two "amount" that must be equivalent to the "total_amount" value. The field can contain two decimal places or none. ## Response parameters - `id` (string, optional) Identifier of the order being processed in the request. - `status` (string, optional) Current status of the order. Possible enum values: - `processed` All transactions have been succesfully processed. - `refunded` The order has been refunded. - `status_detail` (string, optional) Details about payment status. Possible enum values: - `refunded` The order has been refunded. - `partially_refunded` The order has been partially refunded. - `transactions` (object, optional) Contains information about the transactions associated with the order. - `transactions.refunds` (array, optional) Contains information about the refund associated with the order. - `transactions.refunds[].id` (string, optional) Identifier of the refunded order transaction created in the request, automatically generated by Mercado Pago. - `transactions.refunds[].transaction_id` (string, optional) Identifier of the transaction associated with the refund. - `transactions.refunds[].reference_id` (string, optional) Reference ID of the transaction. - `transactions.refunds[].amount` (string, optional) Transaction amount. - `transactions.refunds[].status` (string, optional) Payment status. Possible enum values: - `processed` The payment has been succesfully processed. ## Errors | Status | Error | Description | | ------- | ------- | ----------- | | 400 | empty_required_header | The "X-Idempotency-Key" header is required and was not sent. Make the requisition again including it. | | 400 | 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. | | 400 | 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. | | 400 | refund_amount_exceeds | The requested refund amount is greater than the available amount. | | 404 | order_not_found | Order not found. Please check if you provided the correct order ID. | | 404 | transaction_not_found | Transaction not found. Please check if you provided the correct Transaction ID. | | 409 | 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. | | 409 | order_already_refunded | Order already refunded. | | 409 | cannot_refund_order | Cannot refund order. Please check if the order is already refunded. | | 409 | order_refund_already_in_process | There is already a full refund request in process for the order in question. | | 500 | idempotency_validation_failed | Validation fail. Please try submitting the request again. | | 500 | internal_error | Generic error. Please try submitting the request again. | ## Request example ### cURL ```bash curl -X POST \ 'https://api.mercadopago.com/v1/orders/{order_id}/refund' \ -H 'Content-Type: application/json' \ -H 'Authorization: Bearer ' \ -d '{ "transactions": [ { "id": "PAY01J67CQQH5904WDBVZEM4JMEP3", "amount": "50.00" } ] }' ``` ## Response example ```json { "id": "ORD01J49MMW3SSBK5PSV3DFR32959", "status": "processed", "status_detail": "refunded", "transactions": { "refunds": [ { "id": "REF01J49MMW3SSBK5PSV3DFR32959", "transaction_id": "PAY01JEVQM06WDW16MAQ8B5SC0MSC", "reference_id": "01JEVQM899NWSQC4FYWWW7KTF9", "amount": "24.50", "status": "processed" } ] } } ```