# Statuses

> Every checkout, transaction, refund, payout, dispute and merchant status, what each one means, and how they change.

All statuses come from Moov evidence. NorthechPay derives a checkout's status in one place, from the Moov payment link and the Moov transfers made through it. Nothing your buyer's browser does can change a status.

## Checkouts

Checkouts and payment links share these statuses.

| Status               | Meaning                                                                                                        | `paid`  | Fulfil?           |
| -------------------- | -------------------------------------------------------------------------------------------------------------- | ------- | ----------------- |
| `creating`           | Saved, but the Moov link is not confirmed yet (usually after a timeout). `checkout_url` is `null`.             | `false` | No                |
| `creation_failed`    | Moov rejected the link, or none was found 15 minutes after an unknown outcome. Final for this idempotency key. | `false` | No                |
| `open`               | The link is active and waiting for payment.                                                                    | `false` | No                |
| `processing`         | A payment is in flight at Moov, or Moov marked the link used and the transfer is not visible yet.              | `false` | No                |
| `authorized`         | The card was approved. Funds are settling to the merchant wallet.                                              | `false` | No                |
| `paid`               | Moov reports the transfer `completed` into the merchant wallet.                                                | `true`  | Yes               |
| `failed`             | The latest attempt failed or was declined. The buyer can retry while the link is active.                       | `false` | No                |
| `expired`            | The link expired with no payment in flight or completed.                                                       | `false` | No                |
| `disabled`           | The link was disabled with no payment in flight or completed.                                                  | `false` | No                |
| `partially_refunded` | Paid, then part of it was refunded.                                                                            | `true`  | Already fulfilled |
| `refunded`           | Paid, then refunded in full.                                                                                   | `true`  | Already fulfilled |
| `disputed`           | Paid, then the cardholder disputed it.                                                                         | `true`  | Review            |
| `reversed`           | The completed payment was reversed.                                                                            | `false` | Review            |

`paid` means "the money reached the wallet at some point". It stays `true` after a refund or dispute. Check `status` to see what happened since.

When several things are true at once, the status follows this order: a completed payment wins over anything in flight, and on a completed payment `disputed` wins over `refunded` and `partially_refunded`.

```text
                 ┌──────────────► creation_failed
                 │
creating ──► open ──► processing ──► authorized ──► paid ──┬──► partially_refunded ──► refunded
               │  ▲        │              │                ├──► refunded
               │  │        ▼              ▼                ├──► disputed
               │  └──── failed ◄──────────┘                └──► reversed
               │     (buyer retries on the same link)
               ├──► expired
               └──► disabled
```

Steps can be skipped. If NorthechPay first sees a payment after it has completed, the checkout goes from `open` straight to `paid`. `creating` can also become `open` once the link is found at Moov.

Webhook events. The checkout status above is the overall picture; events report each payment, refund and dispute:

| Fact                                        | Event                                   |
| ------------------------------------------- | --------------------------------------- |
| Checkout created (`open`)                   | `checkout.created`                      |
| A payment is in flight                      | `checkout.processing`                   |
| A card payment was approved, still settling | `checkout.authorized`                   |
| A payment completed                         | `checkout.paid`                         |
| A payment attempt failed or was declined    | `checkout.failed`                       |
| The checkout expired / was disabled         | `checkout.expired`, `checkout.disabled` |
| A refund completed                          | `checkout.refunded`                     |
| An accepted refund failed                   | `checkout.refund_failed`                |
| A completed payment was reversed            | `checkout.reversed`                     |
| A payment was disputed                      | `checkout.disputed`                     |

Payment, refund and dispute events are sent once per payment, refund or dispute, not once per checkout: `checkout.paid` once for each completed payment, `checkout.refunded` once for each completed refund (and `checkout.refund_failed` for a failed one), `checkout.disputed` once for each dispute. `checkout.expired` and `checkout.disabled` are sent once per checkout. See [Webhooks](/docs/webhooks).

## Transactions

A transaction's `status` is the Moov transfer status.

| Status             | Meaning                            | Final |
| ------------------ | ---------------------------------- | ----- |
| `created`          | Moov created the transfer.         | No    |
| `pending`          | In progress.                       | No    |
| `queued`           | Waiting to be processed.           | No    |
| `awaiting-capture` | Waiting for capture.               | No    |
| `completed`        | Money reached its destination.     | Yes   |
| `failed`           | Failed or declined. See `failure`. | Yes   |
| `canceled`         | Canceled.                          | Yes   |
| `reversed`         | A completed transfer was reversed. | Yes   |

```text
created / pending / queued / awaiting-capture   (in flight, may move between these)
        │
        ├──► completed ──► reversed
        ├──► failed
        └──► canceled
```

Statuses only move forward. A late update can never move `completed` back to `pending`. `rail_status` adds the card or bank step, for example card `confirmed`, `settled`, `completed`.

## Refunds

The API does not return refund objects. You see a refund through the transaction's `refunded_amount`, the checkout's `partially_refunded` or `refunded` status, and the `checkout.refunded` event. For support conversations, NorthechPay's internal refund record uses these statuses:

| Status            | Meaning                                                       |
| ----------------- | ------------------------------------------------------------- |
| `requested`       | Saved, not yet answered by Moov.                              |
| `outcome_unknown` | Moov timed out or could not be reached. The refund may exist. |
| `pending`         | Moov accepted the refund and is processing it.                |
| `completed`       | Moov completed the refund.                                    |
| `failed`          | Moov rejected or failed the refund.                           |

```text
requested ──► pending ──► completed
    │            └──────► failed
    ├──► failed            (Moov rejected the request)
    └──► outcome_unknown   (check refunded_amount on the transaction)
```

## Payouts

| Status            | Label                 | Meaning                                                 | Final |
| ----------------- | --------------------- | ------------------------------------------------------- | ----- |
| `requested`       | Requested             | Saved, not yet sent to Moov.                            | No    |
| `submitted`       | Submitted to Moov     | Moov accepted the transfer.                             | No    |
| `outcome_unknown` | Awaiting confirmation | Moov timed out. NorthechPay is looking the transfer up. | No    |
| `pending`         | In transit            | Moving to the bank.                                     | No    |
| `completed`       | Completed             | Moov reports the payout completed.                      | Yes   |
| `failed`          | Failed                | Moov rejected or failed it. See `failure`.              | Yes   |
| `canceled`        | Canceled              | Canceled at Moov.                                       | Yes   |
| `reversed`        | Returned              | The bank returned the payout.                           | Yes   |

```text
requested ──► submitted ──► pending ──┬──► completed
    │                          ▲      ├──► failed
    ├──► outcome_unknown ──────┘      ├──► canceled
    │    (or straight to a final      └──► reversed (returned)
    │     status once Moov answers)
    └──► failed (Moov rejected the request)
```

| Status entered                     | Event              |
| ---------------------------------- | ------------------ |
| `submitted` or `pending`           | `payout.pending`   |
| `completed`                        | `payout.completed` |
| `failed`, `canceled` or `reversed` | `payout.failed`    |

## Disputes

Dispute statuses come straight from Moov.

| Status            | Meaning                                                | Can respond              |
| ----------------- | ------------------------------------------------------ | ------------------------ |
| `response-needed` | Moov is waiting for evidence or acceptance.            | Yes, before `respond_by` |
| `under-review`    | Evidence was submitted. The card network is reviewing. | No                       |
| `accepted`        | The merchant accepted liability. Moov keeps the debit. | No                       |
| `won`             | Decided for the merchant.                              | No                       |
| `lost`            | Decided for the cardholder.                            | No                       |
| `expired`         | No response before the deadline.                       | No                       |
| `closed`          | Closed by the issuer.                                  | No                       |
| `resolved`        | Resolved.                                              | No                       |
| `unknown`         | Moov sent a status this build does not recognise.      | No                       |

```text
response-needed ──┬──► under-review ──┬──► won
                  │                   └──► lost
                  ├──► accepted
                  ├──► expired
                  └──► closed / resolved
```

`dispute.updated` is sent once for each status a dispute enters.

## Merchants

| Status       | Meaning                                                            |
| ------------ | ------------------------------------------------------------------ |
| `draft`      | The business has not been submitted to Moov.                       |
| `onboarding` | Moov verification is in progress.                                  |
| `active`     | Active in test mode.                                               |
| `restricted` | The account is restricted. Check the dashboard for what is needed. |
| `disabled`   | The account is disabled.                                           |

A merchant can create checkouts only when it is connected to Moov and has the needed capabilities. Otherwise you get `422 merchant_not_ready`.
