> ## Documentation Index
> Fetch the complete documentation index at: https://www.dynamic.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Expiry and cancellation

> How long a Flow payment and its quotes stay valid, who can cancel a flow and when, and what happens to funds sent after a flow ends.

Every Flow payment has an expiry time, each quote has its own expiry time, and a payment can be cancelled before the payer sends it. This page explains how each one works and what happens to funds that arrive after a flow ends.

## Flow expiry

Your server sets how long a flow stays open with `expiresIn`, in seconds, when it creates the flow. The default is 24 hours, and the maximum is 365 days. The flow's `expiresAt` field records the resulting time.

Expiry applies only before the payment is sent, while the flow is in `initiated`, `source_attached`, `quoted`, or `signing`. A flow still in one of those states at `expiresAt` moves to `expired`, which is final. To ask the payer again, your server creates a new flow.

Once the payment is sent (`broadcasted`) or a deposit is seen (`source_detected`), the flow no longer expires. It continues until the payment is confirmed or fails.

Choose an `expiresIn` that gives the payer enough time to choose a source, approve the payment, and, for a deposit address, send funds from wherever they hold them.

## Quote expiry

A quote has its own `expiresAt`, separate from the flow's.

| Source | How long the quote is valid |
| - | - |
| Wallet | 60 seconds |
| Deposit address | 60 seconds |
| Exchange | No quote. The payer pays through a purchase link |

When a wallet quote expires, the flow stays in `quoted`, and the payer cannot approve the payment with that quote. The payer requests a new quote and approves that one. An expired quote does not end the flow.

A deposit address works differently. The address stays open until the flow ends, but the deposit provider guarantees the quoted amount to send for only 60 seconds. The quote's `expiresAt` field shows the flow's expiry, not this 60-second window. If the payer has not sent funds within 60 seconds, request a new quote to refresh the amount; a new quote for the same chain and token usually keeps the same address. Funds sent later to the address can still arrive, but the amount delivered can differ from the original quote.

## Cancelling a flow

Who can cancel depends on the flow's state.

| Who | Can cancel from | Credential |
| - | - | - |
| The payer | `source_attached`, `quoted`, `signing` | The flow's session token |
| Your server | `initiated` | Your environment API token |

Nobody can cancel a flow once the payment is sent. A cancel request that arrives too late is rejected, and the flow keeps its current state. A cancelled flow is final, and its session token stops working.

Hide the cancel action in your UI once the payer has approved a wallet payment. The transaction might already be on its way, and a cancelled flow cannot record it.

## Funds sent after cancellation or expiry

A deposit address remains tied to your destination after its flow ends. If a payer sends funds to the address of a cancelled or expired flow, the deposit provider can still process them, and the funds can reach your destination.

When that happens:

* The flow stays `cancelled` or `expired`. It does not record the payment.
* No webhook reports the payment.
* You are responsible for identifying the payment and for any refund to the payer.

If the deposit provider rejects the deposit instead, it attempts to return the funds to the refund address the payer gave. Dynamic does not initiate that refund.

To reduce the chance of late deposits, show the deposit address only while the flow is open, and tell the payer when the flow expires.

## Next

> **[Failures and refunds](https://www.dynamic.xyz/docs/flow/failures-and-refunds.md)**
>
> What happens when a payment fails, and how refunds are reported.

> **[Payment lifecycle and states](https://www.dynamic.xyz/docs/flow/lifecycle-walkthrough.md)**
>
> Every state and what moves a flow between them.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.