# `Teya.Refund`
[🔗](https://github.com/sgerrand/ex_teya/blob/v0.4.0/lib/teya/refund.ex#L1)

Refund completed transactions.

Required OAuth scope: `refunds/create`.

# `create`

```elixir
@spec create(
  map(),
  keyword()
) :: {:ok, map()} | {:error, Teya.Error.t()}
```

Creates a refund.

Returns `{:ok, response}` where status is `"SUCCESS"`, `"FAILURE"`, or `"PENDING"`.
A `"PENDING"` response (HTTP 202) means the refund is still being processed.

Note: HTTP 460 indicates a challenge is required before the refund can proceed.

## Options

- `idempotency_key` — override the auto-generated idempotency key

## Examples

    {:ok, _} = Teya.Refund.create(%{"transaction_id" => transaction_id})

---

*Consult [api-reference.md](api-reference.md) for complete listing*
