Endpoint
PUT https://api.pagou.ai/v2/transactions/{id}/refund
Reembolsos parciais não estão disponíveis para todos os provedores e dependem da disponibilidade do provedor upstream.
Body
| Campo | Obrigatório | Exemplo | Observação |
|---|
amount | não | 500 | centavos; omitido = tentativa de reembolso total |
reason | não | requested_by_customer | texto livre para auditoria |
Exemplo SDK TypeScript
const refunded = await client.transactions.refund(
"id-da-transacao",
{ amount: 500, reason: "requested_by_customer" },
{ idempotencyKey: "idem-refund-001" },
);
console.log(refunded.data.id, refunded.data.refunded_amount);
Exemplo HTTP (cURL)
curl --request PUT \
--url https://api.pagou.ai/v2/transactions/{id}/refund \
--header "Content-Type: application/json" \
--header "Authorization: Bearer SEU_TOKEN" \
--data '{
"amount": 500,
"reason": "requested_by_customer"
}'
Resposta esperada (resumo)
{
"id": "trx_xxx",
"status": "partially_refunded",
"refunded_amount": 500
}