> ## 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.

# PFMatchmakingTicketGetTicketId

> 检索分配给 PlayFab 多人游戏匹配票证的唯一票证 ID，用于从其他客户端会话加入或引用该票证。

提供票证 ID。

## 语法

```cpp theme={null}
HRESULT PFMatchmakingTicketGetTicketId(  
    PFMatchmakingTicketHandle ticket,  
    const char** id  
)  
```

### 参数

**`ticket`**   PFMatchmakingTicketHandle

匹配票证的句柄。

**`id`**   char\*\*\
*library-allocated output*

票证 ID。

### 返回值

类型：HRESULT

如果调用成功，则为 `S_OK`；否则为错误代码。可以通过 [PFMultiplayerGetErrorMessage()](/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmultiplayer/functions/pfmultiplayergeterrormessage) 获取错误代码的人类可读形式。

## 备注

如果尚未设置票证 ID，则将为空字符串。这可能在以下情况下发生：

* 票证处于 `PFMatchmakingTicketStatus::Creating` 状态
* 由于未能将票证提交到匹配服务，票证处于 `PFMatchmakingTicketStatus::Failed` 状态
* 票证在能够提交到匹配服务之前被取消

## 要求

**头文件：** PFMatchmaking.h

## 另请参阅

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


## Related topics

- [PFMultiplayer C/C++ API 概述 - PFMatchmaking.h](/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/pfmatchmaking_members.md)
- [PlayFab Multiplayer C++ SDK 发行说明](/zh-CN/services/playfab/multiplayer/lobby/lobby-matchmaking-sdks/lobby-and-matchmaking-release-notes.md)
- [MatchmakingTicket.TicketId](/zh-CN/services/playfab/multiplayer/lobby/unity-multiplayer-api-reference/PlayFab.Multiplayer/MatchmakingTicket/TicketId.md)
- [PFMultiplayerJoinMatchmakingTicketFromId](/zh-CN/services/playfab/multiplayer/lobby/playfabmultiplayerreference-cpp/pfmatchmaking/functions/pfmultiplayerjoinmatchmakingticketfromid.md)
- [XblMatchmakingGetMatchTicketDetailsAsync](/zh-CN/reference/live/xsapi-c/matchmaking_c/functions/xblmatchmakinggetmatchticketdetailsasync.md)
