Fire Bankingdocs
Endpoints

Request Refund

Overview

The PUT /pix/:e2eid/devolucao/:id endpoint requests the refund of a received PIX. It uses the End to End ID (e2eid) of the original transaction and a refund identifier generated by the client.

Refunds can be full or partial. The sum of all refunds cannot exceed the original transaction amount.

Endpoint

PUT /pix/{e2eid}/devolucao/{id}

Authentication

stringobrigatorio

Bearer token obtained via /oauth/token.

URL Parameters

e2eidstringobrigatorio

End to End ID - unique identifier of the original PIX transaction. Contains exactly 32 alphanumeric characters.

Example: E12345678901234567890123456789012

idstringobrigatorio

Client-generated identification to represent the refund. Between 1 and 35 characters.

Example: D123456789

Request Body

stringobrigatorio

Amount requested for refund. String in decimal format with 2 decimal places.

The sum of all refund amounts cannot exceed the total amount of the original PIX.

Example: "7.89"

string

Indicates the nature of the requested refund:

  • ORIGINAL: Refund of a standard PIX or purchase amount in PIX Change
  • RETIRADA: Refund of PIX Withdrawal or change amount in PIX Change
string

Text to be shown to the payer containing information about the refund.

Maximum: 140 characters.

Request

curl -X PUT https://api.public.firebanking.com.br/pix/E12345678901234567890123456789012/devolucao/D123456789 \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "valor": "7.89",
    "natureza": "ORIGINAL",
    "descrição": "Devolução solicitada pelo recebedor"
  }'
const e2eid = 'E12345678901234567890123456789012';
const devolucaoId = 'D123456789';

const response = await fetch(
  `https://api.public.firebanking.com.br/pix/${e2eid}/devolucao/${devolucaoId}`,
  {
    method: 'PUT',
    headers: {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      valor: '7.89',
      natureza: 'ORIGINAL',
      descrição: 'Devolução solicitada pelo recebedor',
    }),
  }
);

const devolução = await response.json();
import requests

e2eid = 'E12345678901234567890123456789012'
devolucao_id = 'D123456789'

response = requests.put(
    f'https://api.public.firebanking.com.br/pix/{e2eid}/devolucao/{devolucao_id}',
    headers={
        'Authorization': f'Bearer {token}',
        'Content-Type': 'application/json',
    },
    json={
        'valor': '7.89',
        'natureza': 'ORIGINAL',
        'descrição': 'Devolução solicitada pelo recebedor',
    }
)

devolução = response.json()

Response

{
  "id": "D123456789",
  "rtrId": "D12345678901234567890123456789012",
  "valor": "7.89",
  "natureza": "ORIGINAL",
  "descrição": "Devolução solicitada pelo recebedor",
  "horario": {
    "solicitação": "2024-01-15T10:30:00.000Z"
  },
  "status": "EM_PROCESSAMENTO"
}
{
  "statusCode": 400,
  "message": "Valor deve estar no formato decimal com 2 casas (ex: 7.89)",
  "error": "Bad Request"
}
{
  "statusCode": 404,
  "message": "Transação original não encontrada",
  "error": "Not Found"
}

Response Fields

idstring

Client-generated identification representing the refund (same value sent in the URL).

rtrIdstring

Unique identifier of the refund transaction. Contains 32 characters.

valorstring

Refund amount in string format with 2 decimal places.

naturezastring

Refund nature:

  • ORIGINAL: Standard refund
  • RETIRADA: Withdrawal refund
  • MED_OPERACIONAL: MED refund due to operational failure
  • MED_FRAUDE: MED refund due to fraud suspicion
descriçãostring

Message to the payer regarding the refund.

horarioobject

statusstring

Refund status:

  • EM_PROCESSAMENTO: Refund is being processed
  • DEVOLVIDO: Refund completed successfully
  • NAO_REALIZADO: Refund not completed (failure)
motivostring

Optional field with details about the reason for the current status. Primarily populated in case of failure.

Refund Status

stateDiagram-v2
    [*] --> EM_PROCESSAMENTO: Request sent
    EM_PROCESSAMENTO --> DEVOLVIDO: Success
    EM_PROCESSAMENTO --> NAO_REALIZADO: Failure
    DEVOLVIDO --> [*]
    NAO_REALIZADO --> [*]

Refund Webhook

When the refund is processed, you will receive a V2 webhook of type REFUND:

{
  "type": "REFUND",
  "data": {
    "id": 123,
    "txId": "original-txid",
    "status": "REFUNDED",
    "payment": {
      "amount": "100.00",
      "currency": "BRL"
    },
    "refunds": [
      {
        "status": "LIQUIDATED",
        "payment": {
          "amount": 7.89,
          "currency": "BRL"
        },
        "endToEndId": "D12345678901234567890123456789012",
        "eventDate": "2024-01-15T10:30:00.000Z",
        "information": "Devolução solicitada pelo recebedor"
      }
    ],
    "endToEndId": "E12345678901234567890123456789012",
    "creditDebitType": "DEBIT"
  }
}

REFUND Webhooks

See the full REFUND webhook documentation

Refund Nature

NatureDescription
ORIGINALStandard PIX refund
RETIRADAPIX Withdrawal or Change refund
MED_OPERACIONALMED due to operational failure
MED_FRAUDEMED due to fraud suspicion

The values MED_OPERACIONAL and MED_FRAUDE are only returned in the response and cannot be sent in the request. They are used in specific cases of the Special Refund Mechanism (MED).

Refund Deadline

Refunds can be requested up to 89 days after receiving the original PIX, as per Central Bank regulations.

Partial Refunds

You can request multiple partial refunds:

// Original transaction: R$ 100.00

// First refund: R$ 30.00
await requestRefund(e2eid, 'DEV001', '30.00');
// Available balance for refund: R$ 70.00

// Second refund: R$ 50.00
await requestRefund(e2eid, 'DEV002', '50.00');
// Available balance for refund: R$ 20.00

// Third refund: R$ 25.00 - ERROR!
await requestRefund(e2eid, 'DEV003', '25.00');
// Failure: amount exceeds available balance (R$ 20.00)

Common Errors

CodeErrorSolution
400Invalid valueUse the format "7.89" (string with 2 decimals)
400Value exceeds availableCheck the available balance for refund
404Transaction not foundVerify the e2eid provided
404Transaction is not a receiptRefunds are only for received PIX
422Deadline expiredRefunds only up to 89 days after receipt

Next Steps

On this page