# The two states of a charge

This confuses almost everyone the first time, so it goes separately and up front: **a charge has two states at once, and they are not the same sequence.**

|                      | What it answers    | Where it is read                           |
| -------------------- | ------------------ | ------------------------------------------ |
| **Charge state**     | Did they pay?      | `GET /v1/pagos/:id` → `estado`             |
| **Settlement state** | Where is my money? | `GET /v1/pagos/:id/liquidacion` → `estado` |

They do not advance together and they do not follow one another. A charge can have been `aprobado` for three days and its settlement still be `en_espera`. The names even look alike —there is a `fallido` in both— and that makes the confusion worse.

## The charge state: did they pay?

```
creado → pendiente → aprobado → conciliado
                  ↘ fallido
     aprobado → reembolsado
```

| State                 | What happened                                                |
| --------------------- | ------------------------------------------------------------ |
| `creado`, `pendiente` | Nobody has paid yet.                                         |
| `aprobado`            | The bank approved. **This is where you ship.**               |
| `fallido`             | The payment did not complete.                                |
| `conciliado`          | Beyond the payment, the money already matched the statement. |
| `reembolsado`         | It was returned to the payer.                                |

This is what the webhook tells you, and it is the only thing you need in order to decide whether to hand over the order.

## The settlement state: where is my money?

The first line is the **credited to your balance** path, the one new accounts use; the second, the **batch** path. A charge goes down only one.

```
sin_recaudo → abonado ↘ devuelto

sin_recaudo → en_recaudo → en_espera → disponible → en_lote → pagado
                                    ↘ retenido
```

| State         | What happened                                                                 |
| ------------- | ----------------------------------------------------------------------------- |
| `sin_recaudo` | Nobody has paid yet. There is nothing to settle.                              |
| `en_recaudo`  | Your customer paid. The money is not confirmed in the collection account yet. |
| `en_espera`   | Confirmed. Your settlement term is running.                                   |
| `disponible`  | The term is up: it goes into the next batch.                                  |
| `retenido`    | Held on purpose, until somebody releases it.                                  |
| `en_lote`     | In a prepared batch, pending transfer.                                        |
| `pagado`      | Transferred to your account.                                                  |

This changes nothing about what you have to do with the order. It is for answering your accountant.

## How they relate

The only thing that links them is the beginning: **until the charge is `aprobado`, the settlement is `sin_recaudo`.** From there on they run on their own.

Said the other way round, which is how it is usually needed:

- A charge that is `aprobado` does **not** mean you already have the money.
- A settlement that is `pagado` does mean the charge was approved a while ago.
- A charge that is `conciliado` means the money reached the collection account. **It is still not yours yet**: your term is pending and the batch is pending.

> **To decide whether to ship, look at the charge state. To answer someone asking about their money, look at the settlement state.** Mixing them up is what leads to telling a customer «we already paid you» when what happened is that the bank approved.
