# Invoice processing lifecycle

> Invoice flow from creation through confirmation, AML screening, and balance credit.

See Invoice [statuses](https://docs.cryptonly.net/guides/invoices/statuses.md) for the full status table and integration notes.

## Create, listen, then settle

1. Create a payment request through the API
2. Redirect the customer to the payment link
3. Listen for `invoice.statusChanged` webhook events
4. Update your internal order or payment status only after the invoice reaches a settled payment status (`paid`, `partially_paid`, or `overpaid`)

## Invoice lifecycle

1. **Merchant creates an invoice request**

   An invoice can be created either:

   * through the **admin panel**
   * via the **API** (`POST /invoice`)

   The create response includes `paymentPageUrl` for the hosted checkout. Default invoice expiry is **24 hours** unless you pass `expiresInMinutes` on create.

1. **Customer opens the link and selects a cryptocurrency**

   The customer visits the hosted payment page and chooses which supported cryptocurrency to pay with.

   Each network option shows its [network fee](https://docs.cryptonly.net/guides/fees-and-commissions.md#deposit-network-fee) in the invoice's fiat currency.

   Cryptonly assigns a unique deposit address, used for this payment attempt only, and locks the crypto amount: the invoice amount plus the network fee. The invoice **status stays `created`** — no additional `invoice.statusChanged` webhook is sent. If the customer changes currency, the invoice remains `created` throughout.

   The deposit payment link is valid for **30 minutes** by default. A payment that arrives at this address within **4 hours** after it expires — or after the customer switched to another currency — is still processed normally. See [Late payments](https://docs.cryptonly.net/guides/invoices/statuses.md#late-payments).

   The customer then sends that amount to the deposit address.

1. **Cryptonly waits for the required on-chain confirmation(s)**

   Once the transfer is detected on-chain, Cryptonly waits for the required number of blockchain confirmations before proceeding. See [Onchain confirmations](https://docs.cryptonly.net/guides/onchain-confirmations.md) for the number required per chain.

1. **Cryptonly performs an AML check**

   After the required confirmations, Cryptonly screens the transaction. It can pass and continue, be flagged for review, or be held.

1. **If the AML check passes, the invoice is settled and the balance is credited**

   Cryptonly settles the invoice with a payment-received status (`paid`, `partially_paid`, or `overpaid`) and credits the merchant's internal balance (the received amount minus the network fee and commission).

1. **Cryptonly sends webhooks on status changes**

   Cryptonly sends an `invoice.statusChanged` webhook on each invoice status transition.

## Related pages

- [Statuses](https://docs.cryptonly.net/guides/invoices/statuses.md): Status table and late payments
- [Onchain confirmations](https://docs.cryptonly.net/guides/onchain-confirmations.md): How many confirmations each network requires
- [Fees and commissions](https://docs.cryptonly.net/guides/fees-and-commissions.md): Network fee added on the payment page
- [Webhooks](https://docs.cryptonly.net/api-reference/webhooks.md): Verify invoice.statusChanged
