# Payment lifecycle

The states one payment passes through, from the agent's request to the receipt, including approvals, denials and payments whose outcome is not yet known.

<ShortProductTruth>**A request goes in. A receipt comes out.** Every payment, on every rail, is one intent that moves through a fixed set of states. Nothing is signed unless the policy says ALLOW or a person approves, and nothing is signed twice.</ShortProductTruth>

## Follow one payment [#follow-one-payment]

Pick a scenario and step through it. The state names on the right are the ones Abazi records.

<PaymentLifecycle />

## The stages [#the-stages]

1. **Request.** The agent calls one tool with what it wants and an idempotency key. Repeating the key returns the same intent; a different request under the same key is refused.
2. **Quote.** Abazi prices the purchase from the Catalog or from the merchant's live 402 response, never from a number the agent sends. Shield screens the purchase and its text.
3. **Decision.** The policy engine runs its fixed order and returns ALLOW, REQUIRE APPROVAL or DENY with a reason code. See [Mandates and policy](/docs/concepts/mandates-and-policy).
4. **Reservation.** On ALLOW, the amount is reserved at organization, team and agent level in one transaction. On REQUIRE APPROVAL, nothing is reserved until a person approves and the policy runs again.
5. **Signing.** A durable workflow hands the payment to the signer. The signer rechecks the pause switch, the mandate, the held reservation and the purchase fingerprint, then signs once.
6. **Submitted.** The rail adapter sends the payment and Abazi records the settlement reference.
7. **Settled.** Abazi polls the network until the payment is final. The reservation commits and the double-entry ledger posts.
8. **Receipt.** A signed, hash-chained receipt is issued and its hash is anchored on Solana.

## States [#states]

These are the only state changes the payment record allows. Anything else is refused.

<StateMachine name="payment" />

| State | Means | Money |
| --- | --- | --- |
| created | The intent exists and is being decided. | Nothing reserved. |
| awaiting_approval | The policy asked for a person. | Nothing reserved yet. |
| denied | The policy, the signer or an approver said no. | Any reservation is released. |
| reserved | The amount is held at all three budget levels. | Held. |
| signing | The signer is checking and signing. | Held. |
| submitted | The payment was sent on its rail. | Held. |
| reconciling | The outcome is unclear, for example a timeout after the payment may have left. | Held until the network answers. |
| confirmed | The network confirmed the payment. | Committed; ledger posted; receipt issued. |
| failed | The payment did not happen. | Released. |
| refunded | The merchant returned the money after a dispute or refund. | Returned, with its own receipt. |

## Approvals inside the lifecycle [#approvals-inside-the-lifecycle]

When a purchase needs a person, approvers get a one-time link that expires after <Limit name="approvalTtl" />. Approving takes a passkey. After an approval, the policy engine runs again with the approval attached: steps 5 to 7 pass as approved by the owner, and every deny step still runs. If the purchase changed in the meantime (price, payout address, network or anything else in its fingerprint), the approval is invalidated and the payment is denied with <ReasonCode code="APPROVAL_INVALIDATED" />. See [Approvals](/docs/concepts/approvals).

## Failure cases [#failure-cases]

| Situation | State path | Reason code |
| --- | --- | --- |
| The purchase is above the hard cap | created → denied | <ReasonCode code="HARD_CAP_EXCEEDED" /> |
| Nobody approves in time | created → awaiting_approval → denied | <ReasonCode code="APPROVAL_EXPIRED" /> |
| An approver rejects | created → awaiting_approval → denied | <ReasonCode code="APPROVAL_REJECTED" /> |
| The owner pauses payments after the reservation | created → reserved → denied | <ReasonCode code="KILL_SWITCH_ACTIVE" /> |
| The send times out after the payment may have left | … signing → reconciling → confirmed or failed | none until the network answers |
| The network rejects the transaction | … submitted → failed | none; the reservation is released |

Abazi never retries a signed payment blindly. A payment whose outcome is unknown stays in reconciling, with its money held, until a check against the network says whether it landed.

## Next steps [#next-steps]

<Cards>
  <Card title="Trust zones" href="/docs/architecture/trust-zones" description="See why only the signer can sign, and what it rechecks before it does." />
  <Card title="State machines" href="/docs/api/state-machines" description="Look up the states of approvals, plans, cards, disputes and refunds." />
  <Card title="Verify a receipt" href="/docs/guides/verify-a-receipt" description="Check the receipt that ends every confirmed payment." />
</Cards>

