Refund a charge in full; a charge already refunding or refunded is answered as it is
POST /v1/charges/{id}/refund
Refund a charge in full; a charge already refunding or refunded is answered as it is
POST/v1/charges/{id}/refund
Autenticação
- Chave secretask_…, só no seu servidor
Envie a chave no cabeçalho Authorization: Bearer <chave>.
Parâmetros
idstring · path (uuid)obrigatório
Resposta
200OK
idstring (uuid)obrigatórioobjectstringobrigatórioValores:
chargestatusstringobrigatórioValores:
processingpendingpaidrefund_pendingrefundedchargedbackdeclinedamountintegerpode ser nullobrigatórioInteger cents.
payment_methodstringobrigatórioValores:
cardpixboletoacquirerstringpode ser nullobrigatóriopaymentobjectobrigatórioPix: `qr_code`, `expiration_at`. Boleto: `boleto_url`, `boleto_barcode`, `expiration_date`. Card: empty.
Mostrar campos de
paymentqr_codestringexpiration_atstringboleto_urlstringboleto_barcodestringexpiration_datestring
created_atstringpode ser nullobrigatóriocustomerobjectpode ser nullobrigatórioMasked unless the key is secret; always masked on creation.
Mostrar campos de
customernamestringpode ser nullobrigatórioemailstringpode ser nullobrigatóriodocumentstringpode ser nullobrigatóriodocument_typestringpode ser nullobrigatórioValores:
cpfcnpjpassportphonestringpode ser nullobrigatório
subscriptionstringpode ser nullThe subscription this purchase opened (`sub_…`), or `null`. Answered on creation and on `GET /v1/charges/{id}` only.
metadataobjectpode ser nullThe `metadata` sent on creation, or `null`. Answered on creation and to the secret key; left out of a public key's reads.
Erros
| 400 | The request path could not be decoded (`malformed_path`). |
| 401 | Missing or invalid key, or a public key (`secret_key_required`). |
| 404 | No such charge (`charge_not_found`). |
| 409 | Not paid (`charge_not_refundable`), charged back (`charge_disputed`), a refund already in progress (`refund_in_progress`), or it opened a subscription still being created (`subscription_processing`) or still active (`subscription_active`). |
| 422 | A body was sent (`unknown_parameter`), a boleto (`payment_method_not_refundable`), past the refund window (`refund_window_expired`), or declined by the acquirer (`refund_declined`). |
| 429 | Rate limited. |
| 500 | Unexpected error, or `api_unavailable`. |
| 502 | The refund may or may not have been made (`refund_outcome_unknown`). If it was, a later notice from the acquirer moves the charge to `refund_pending` or `refunded`, which can take hours. |
| 503 | The API is not available (`api_unavailable`); retry. |
Todo erro vem no mesmo envelope: error.type, error.code, error.message e error.request_id, também devolvido no cabeçalho X-Request-Id.