# Referenced refund of an existing card payment.

Referenced refund of an existing card payment.

1. OPTIONAL — searches for the original card payment when you do not have its paymentId (GET /payments), filtering by terminal and/or order id. Skip this step when you already hold the paymentId - use getCardPayment or go straight to refundCardPayment. Take the paymentId of the matching result from `data/0/paymentId` and feed it into the refund step.
 [listPayments](/api/list-payments)
2. OPTIONAL — retrieves the original card payment by paymentId (GET /payments/{paymentId}) to confirm its details and status before refunding. A referenced refund only returns funds when the payment is in a closed batch; an open-batch payment is reversed instead.
 [getPayment](/api/get-payment)
3. Refunds the referenced card payment (POST /payments/{paymentId}/refund). Requires the Idempotency-Key header and a body with `amount` and `description` (`operator` optional). The refund id is nested at `refunds/0/refundId`, not at the body root. Returns 200.
 [refundPayment](/api/refund-payment)

## Workflow diagram

```mermaid
flowchart TD
  step0["1. payment search · API"]
  step1["2. payment lookup · API"]
  step0 --> step1
  step2["3. refund request · API"]
  step1 --> step2
```
