# Order lifecycle

Every order moves forward only. status is the exact state; stage folds it into the steps a person sees.

Statuses:

```
created → awaiting_payment → paid → delegating → delivered
                │                       │
                └→ expired              └→ failed → refunded

stage (for a progress bar):
  waiting → seen → ready      or      failed / refunded
```

| status | stage | Meaning |
| --- | --- | --- |
| `created` | `waiting` | The order exists; a deposit address is reserved. |
| `awaiting_payment` | `waiting` | Pay the exact amount before expiresAt. An underpayment can be topped up until then. |
| `paid` | `seen` | The payment is confirmed on chain (or debited from the balance). |
| `delegating` | `seen` | The Router buys the energy from the cheapest vetted source that can deliver it. |
| `delivered` | `ready` | Energy is on the address. delivery.txId is the delegation on Tronscan. |
| `expired` | `waiting` | No payment in time. A payment that arrives later is refunded. |
| `failed` | `failed` | No provider delivered. The full payment is refunded automatically. |
| `refunded` | `refunded` | The money went back to the address that paid (or to the balance). |

## Tracking an order

Poll [Retrieve an order](https://feebolt.com/developers/retrieve-order/) every 2 to 3 seconds while `stage` is `waiting` or `seen`. Each call checks the chain for that order, so you see the payment and the delivery within seconds; stop at `ready`, `failed` or `refunded`. Orders nobody polls are finished by a background job every minute.

---

HTML: https://feebolt.com/developers/order-lifecycle/ · OpenAPI: https://feebolt.com/developers/openapi.json · All docs as one Markdown file: https://feebolt.com/developers/full.md
