# The Refund object

> A refund returns all or part of a paid payment to the payer.

Source: https://rais.app/docs/api/objects/refund

A payment can be refunded several times, never beyond what was paid. Refund events carry this object in `data.object`.

## Attributes

- `id` (string): The unique identifier of the refund.
- `object` (string): The type of the object. Always `refund`.
- `payment_id` (string): The payment that was refunded.
- `amount` (integer): The amount refunded, in centimes.
- `currency` (string): The currency. Always `DZD`.
- `status` (string): `succeeded`: SATIM refunded. `failed`: SATIM refused (see `failure`). `pending`: the request was sent but SATIM's answer was lost; the amount stays reserved until the refund is checked. Do not retry with a new Idempotency-Key before looking at it. One of `succeeded`, `failed`, `pending`.
- `reason` (string, nullable): The reason you gave.
- `failure` (object, nullable): Why the refund failed; set when `status` is `failed`.
  - `code` (string): Why it failed, machine-readable: `payment_declined`, `processing_error`, `gateway_unavailable`, `refund_declined`...
  - `message` (string): Why it failed, in words.
- `fees` (object, nullable): What this refund cost you, in centimes, excluding VAT (a flat fee per refund, whatever its amount). Set once the refund `succeeded`; `null` while it is `pending` and when it `failed` (a refund that did not happen costs nothing). A test refund shows the simulated fees.
  - `satim` (integer): SATIM's fee, in centimes, excluding VAT.
  - `rais` (integer): Raïs's fee, in centimes, excluding VAT.
  - `total` (integer): What the transaction costs: `satim` + `rais`, in centimes, excluding VAT.
- `livemode` (boolean): `false` for a sandbox refund.
- `created` (integer): When the refund was requested (Unix time, seconds).

## Example

```json
{
  "id": "0c8a1d52-6e7b-4f0a-9b3d-7d2e4a8c5f10",
  "object": "refund",
  "payment_id": "5b1c2f4e-9d3a-4c61-8a7e-0f2d6b9e1a33",
  "amount": 150000,
  "currency": "DZD",
  "status": "succeeded",
  "reason": "Customer returned one item",
  "failure": null,
  "fees": {
    "satim": 800,
    "rais": 200,
    "total": 1000
  },
  "livemode": false,
  "created": 1793000900
}
```
