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

# PFMatchmakingTicketSetCustomContext

> Attaches an optional pointer-sized custom context value to a PlayFab Multiplayer matchmaking ticket for later retrieval by the application.

Configures an optional, custom pointer-sized context value with this ticket object.

## Syntax

```cpp theme={null}
HRESULT PFMatchmakingTicketSetCustomContext(  
    PFMatchmakingTicketHandle ticket,  
    void* customContext  
)  
```

### Parameters

**`ticket`**   PFMatchmakingTicketHandle

The handle of the matchmaking ticket.

**`customContext`**   void\*\
*optional*

An arbitrary, pointer-sized value to store with the player object.

### Return value

Type: HRESULT

`S_OK` if configuring the custom context succeeded or an error code otherwise. The human-readable form of the error code can be retrieved via [PFMultiplayerGetErrorMessage()](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/functions/pfmultiplayergeterrormessage.md).

## Remarks

The custom context is typically used as a "shortcut" that simplifies accessing local, title-specific memory associated with the matchmaking ticket without requiring a mapping lookup. The value is retrieved using the [PFMatchmakingTicketGetCustomContext()](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/functions/pfmatchmakingticketgetcustomcontext.md) method. \
\
&#x20;Any configured value is treated as opaque by the library, and is only valid on the local device; it is not transmitted over the network.

## Requirements

**Header:** PFMatchmaking.h

## See also

[PFMatchmaking members](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/pfmatchmaking_members.md)\
[PFMatchmakingTicketGetCustomContext](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/functions/pfmatchmakingticketgetcustomcontext.md)


## Related topics

- [PFMatchmakingTicketGetCustomContext](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/functions/pfmatchmakingticketgetcustomcontext.md)
- [PlayFab Multiplayer C++ SDK Release Notes](https://docs.xbox.com/services/playfab/multiplayer/lobby/lobby-matchmaking-sdks/lobby-and-matchmaking-release-notes.md)
- [PFMultiplayer C/C++ API overview - PFMatchmaking.h](https://docs.xbox.com/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/pfmatchmaking_members.md)
- [MatchmakingTicket.Context](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/MatchmakingTicket/Context.md)
- [Real-time messages for Lobby and Matchmaking APIs](https://docs.xbox.com/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/MatchmakingTicket/overview.md)
