Criar reembolso - Reembolsos - Mercado Pago Developers
Criar reembolso

POST

/v1/payments/{id}/refunds
Criar um reembolso parcial/total para um pagamento específico. Se o campo amount estiver preechido, será criado um reembolso parcial, caso contrário, se criará um reembolso total.
Parâmetros de requisição
id

OBRIGATÓRIO

string
Localização: pathIdentificador de pagamento
X-Idempotency-Key
string
Localização: headerIdempotency key. Quando usada, evita reembolsos duplicados
amount
number
Localização: bodyValor do reembolso. Se a propriedade (amount) for removida do body, criará um reembolso integral.
Parâmetros de resposta
id
number
Localização: bodyIdentificador do reembolso
payment_id
number
Localização: bodyIdentificador de pagamento
amount
number
Localização: bodyValor do reembolso
metadata
array
Localização: bodyContém metadados de pagamento que nos são enviados no post de payment
Solicitação
curl
curl -X POST \
      'https://api.mercadopago.com/v1/payments/{id}/refunds' \
       -H 'Authorization: Bearer YOUR_ACCESS_TOKEN \
       -H 'Content-Type: application/json' \ 
      -H 'X-Idempotency-Key: 77e1c83b-7bb0-437b-bc50-a7a58e5660ac' \
      -d '{
  "amount": 5
}'
Resposta
json
{
  "id": 1009042015,
  "payment_id": 18552260055,
  "amount": 10,
  "metadata": [
    {}
  ],
  "source": [
    {
      "name": "Nome e sobrenome",
      "id": "1003743392",
      "type": "collector"
    }
  ],
  "date_created": "2021-11-24T13:58:49.312-04:00",
  "unique_sequence_number": null,
  "refund_mode": "standard",
  "adjustment_amount": 0,
  "status": "approved",
  "reason": null,
  "label": [
    {}
  ],
  "partition_details": [
    {}
  ]
}
Erros
400bad_request
2063 missing information on header or the payment was fully refund-
2085Invalid-value-for-gateway_operation-
401bad_request
401 Valid token required
4040 Amount should be more than 0
4041 Amount should be a number
404bad_request
2000 Payment_id does not exist
2024Payment-too-old-to-be-refunded
2032 X-Idempontency-key already used
3012Invalid parameter security_code_length
3024Not valid action - partial refund unsupported for this transaction
4211 Triggered when empty or null is sent in the charge_details field
4248Charge not found - Shown when the charge is not found
4291 Triggered when empty or null is sent in the charge_id field
4292 Triggered when the X-Idempotency-Key parameter is not sent and charges idempotency is enabled.
4293 Triggered when the status and status_detail of the payment are different from "approved" and "accredited" respectively
4294 Triggered when trying to refund a charge type that is not allowed.
4295 Triggered when attempting to partially refund a charge.
4296 Triggered when trying to refund a charge that has already been refunded.
4297 Triggered when the charge id has an invalid format.
15016Payment-too-old-to-be-refunded