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

# PFMatchmakingTicketCancel

> Cancels an in-progress PlayFab Multiplayer matchmaking ticket, stopping the search for a match and transitioning the ticket to a canceled status.

Cancels the ticket.

## Syntax

```cpp theme={null}
HRESULT PFMatchmakingTicketCancel(  
    PFMatchmakingTicketHandle ticket  
)  
```

### Parameters

**`ticket`**   PFMatchmakingTicketHandle

The handle of the matchmaking ticket.

### Return value

Type: HRESULT

`S_OK` if the call succeeded or an error code otherwise. The human-readable form of the error code can be retrieved via [PFMultiplayerGetErrorMessage()](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/functions/pfmultiplayergeterrormessage).

## Remarks

This method queues an asynchronous operation to cancel this matchmaking ticket. On success, a [PFMatchmakingTicketCompletedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/structs/pfmatchmakingticketcompletedstatechange) will be provided indicating that the ticket has been canceled. <br /><br /> This method does not guarantee the ticket will be canceled. The ticket may complete before the cancelation can be processed, or the cancelation request may fail due to networking or service errors. If the cancelation attempt fails but is retriable, the library will continue to retry the cancelation. Otherwise, a [PFMatchmakingTicketCompletedStateChange](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/structs/pfmatchmakingticketcompletedstatechange) will be provided that indicates the ticket failed.

## Requirements

**Header:** PFMatchmaking.h

## See also

[PFMatchmaking members](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/pfmatchmaking_members)


## Related topics

- [Matchmaking SDK quickstart](/services/playfab/multiplayer/matchmaking/quickstart-client-sdk.md)
- [Using Server Backfill Tickets - Multiplayer SDK](/services/playfab/multiplayer/matchmaking/backfill-tickets-multiplayer-sdk.md)
- [PFMultiplayer C/C++ API overview - PFMatchmaking.h](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/pfmatchmaking_members.md)
- [PlayFab Multiplayer C++ SDK Release Notes](/services/playfab/multiplayer/lobby/lobby-matchmaking-sdks/lobby-and-matchmaking-release-notes.md)
- [MatchmakingTicket.Cancel](/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/MatchmakingTicket/Cancel.md)
