# `Payzum.Status`
[🔗](https://github.com/payzum-dev/payzum-elixir/blob/main/lib/payzum/status.ex#L1)

One canonical payment status, mapped from the two vocabularies the API uses.

The merchant surface emits five values and the buyer surface emits six, with no
name in common. Without one mapping every integrator invents their own, and the
interesting cases are exactly where they get it wrong.

# `all`

The five canonical wire values.

# `from_buyer`

```elixir
@spec from_buyer(term()) ::
  {:ok, String.t()} | {:error, Payzum.Errors.UnknownStatus.t()}
```

Map `status` from the buyer surface (`GET /v1/invoices/{id}/status`).

`overpaid` collapses to `finished` and `cancelled` to `failed`, so both surfaces
produce the same canonical value for the same invoice.

# `from_merchant`

```elixir
@spec from_merchant(term()) ::
  {:ok, String.t()} | {:error, Payzum.Errors.UnknownStatus.t()}
```

Map `payment_status` from the merchant surface.

`unconfirmed` does not exist — older docs listed it. `overpaid` arrives as
`finished` and `cancelled` as `failed`.

# `paid?`

The invoice was paid in full and is safe to fulfil.

# `terminal?`

No further transitions happen from here.

---

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