Skip to main content
Cancels a flow before the payment is sent. A cancelled flow is final: the payer cannot resume it, and a new attempt needs a new flow from your server. Cancelling also removes the flow’s session token from the device.

When to call

Call cancelFlow when executionState is source_attached, quoted, or signing. Cancelling needs the session token that attaching a source stores, so it works only on the device that attached the source.
  • A flow in initiated has no session token yet. Your server can cancel it with its API token, as described in the Flow payments API guide.
  • Nobody can cancel a flow once the payment is sent. Hide the cancel button as soon as the payer approves a wallet payment.
Do not cancel after the payer declines in the wallet. The flow already has a new quote, so the payer can try again or choose another way to pay on the same flow.

Usage

Parameters

Returns

Promise<Flow>: the flow with executionState: 'cancelled'.

Examples

Show the state when cancelling is too late

Errors

Handle Flow errors describes each error.

React

useCancelFlow is a mutation hook. It writes the cancelled flow into the useGetFlow cache, and on FlowStateConflictError it refetches the flow so the page shows its real state.
Last modified on October 28, 2026