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

# useCancelOrder

> The useCancelOrder hook allows users to cancel a listing of an NFT that is currently for sale on the Marketplace. It handles the cancellation process and transaction execution.

```ts theme={null}
import { useCancelOrder } from '@0xsequence/marketplace-sdk/react';

## Into your React component:

const { cancelOrder } = useCancelOrder({
  chainId,
  collectionAddress
});

const onClickCancel = () => {
  cancelOrder({
    marketplace,
    orderId,
  });
};

return <button onClick={onClickCancel}>Cancel Order</button>;
```

<ResponseField name="useCancelOrder">
  <ResponseField name="* params" />

  <Expandable>
    ```ts theme={null}
    interface UseCancelOrderArgs {
      collectionAddress: string;
      chainId: number;
      onSuccess?: ({ hash, orderId }: {
        hash?: string;
        orderId?: string;
      }) => void;
      onError?: (error: Error) => void;
    }
    ```
  </Expandable>

  <ResponseField name="* return properties" />

  <Expandable>
    <ResponseField name="cancelOrder" type="(args: CancelOrderArgs) => void">
      ```ts theme={null}
      interface CancelOrderArgs {
        orderId: string;
        marketplace: MarketplaceKind;
      }
      ```
    </ResponseField>

    <ResponseField name="isExecuting" type="boolean" />

    <ResponseField name="cancellingOrderId" type="string | null" />
  </Expandable>
</ResponseField>
