docs

Devoluções

Devolve, total ou parcialmente, um Pix recebido. Não há tarifa. O total devolvido não passa do líquido creditado na cobrança. Webhooks: pix.refund.completed quando conclui e pix.refund.failed quando o liquidante recusa (o saldo não é debitado e failureReason diz o motivo).

Solicitar uma devolução

POSThttps://api.onzepay.com/v1/refunds
refunds.writeIdempotency-Key

Informe a cobrança por chargeId ou pelo endToEndId do Pix recebido.

Corpo

chargeIdstring
Id da cobrança (chg_…).
endToEndIdstring
Alternativa ao chargeId.
amountintegerobrigatório
Valor em centavos.
externalIdstring
Seu identificador. Único por conta.
reasonstring
Motivo (até 240 caracteres).

Erros

  • 400REFUND_TOO_HIGHPassa do líquido creditado.
  • 400INVALID_CHARGECobrança não paga ou não encontrada.
  • 409EXTERNAL_ID_CONFLICTJá existe devolução com este externalId.
curl -X POST "$ONZEPAY_API/v1/refunds" \
  -H "Authorization: Bearer $ONZEPAY_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
  "chargeId": "chg_034yDKstyRbto2AiOEPZJP",
  "amount": 3000,
  "externalId": "refund-4821",
  "reason": "Cliente desistiu da compra"
}'
Resposta 201
{
  "id": "rfd_034yDL0aB7cD9eF1gH2iJ3",
  "externalId": "refund-4821",
  "chargeId": "chg_034yDKstyRbto2AiOEPZJP",
  "endToEndId": "D12345678202611161230abcdef987654",
  "amount": 3000,
  "feeAmount": 0,
  "status": "completed",
  "origin": "spontaneous",
  "reason": "Cliente desistiu da compra",
  "failureReason": null,
  "createdAt": "2026-11-16T12:30:00.000Z"
}

Consultar uma devolução

GEThttps://api.onzepay.com/v1/refunds/{id}
refunds.read

Parâmetros de caminho

idstringobrigatório
Id da devolução (rfd_…).
curl -X GET "$ONZEPAY_API/v1/refunds/rfd_034yDL0aB7cD9eF1gH2iJ3" \
  -H "Authorization: Bearer $ONZEPAY_SECRET_KEY"
Resposta 200
{
  "id": "rfd_034yDL0aB7cD9eF1gH2iJ3",
  "externalId": "refund-4821",
  "chargeId": "chg_034yDKstyRbto2AiOEPZJP",
  "endToEndId": "D12345678202611161230abcdef987654",
  "amount": 3000,
  "feeAmount": 0,
  "status": "completed",
  "origin": "spontaneous",
  "reason": "Cliente desistiu da compra",
  "failureReason": null,
  "createdAt": "2026-11-16T12:30:00.000Z"
}

Buscar devoluções

GEThttps://api.onzepay.com/v1/refunds
refunds.read

Com chargeId, lista as devoluções da cobrança. Com só externalId, devolve a devolução direto.

Query

chargeIdstring
Id da cobrança (chg_…).
externalIdstring
Seu identificador.
curl -X GET "$ONZEPAY_API/v1/refunds?chargeId=chg_034yDKstyRbto2AiOEPZJP" \
  -H "Authorization: Bearer $ONZEPAY_SECRET_KEY"
Resposta 200
{
  "data": [
    {
      "id": "rfd_034yDL0aB7cD9eF1gH2iJ3",
      "externalId": "refund-4821",
      "chargeId": "chg_034yDKstyRbto2AiOEPZJP",
      "endToEndId": "D12345678202611161230abcdef987654",
      "amount": 3000,
      "feeAmount": 0,
      "status": "completed",
      "origin": "spontaneous",
      "reason": "Cliente desistiu da compra",
      "failureReason": null,
      "createdAt": "2026-11-16T12:30:00.000Z"
    }
  ]
}