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

# XStoreShowPurchaseUIAsync

> XStoreShowPurchaseUIAsync

# XStoreShowPurchaseUIAsync

지정된 제품에 대한 구매 UI 오버레이를 시작합니다.

## 구문

```cpp theme={null}
HRESULT XStoreShowPurchaseUIAsync(  
         const XStoreContextHandle storeContextHandle,  
         const char* storeId,  
         const char* name,  
         const char* extendedJsonData,  
         XAsyncBlock* async  
)  
```

### 매개 변수

*storeContextHandle*   \_In\_\
형식: XStoreContextHandle

[XStoreCreateContext](/reference/system/xstore/functions/xstorecreatecontext)에서 반환된 사용자의 스토어 컨텍스트 핸들입니다.

*storeId*   \_In\_z\_\
형식: char\*

구매할 제품의 ID입니다.

*name*   \_In\_opt\_z\_\
형식: char\*

구매할 제품의 이름입니다.

*extendedJsonData*   \_In\_opt\_z\_\
형식: char\*

구매 흐름에 전달되는 JSON blob입니다. 사용자 지정 캠페인 ID를 삽입할 수 있으므로 구매가 어떻게 시작되었는지 추적할 수 있습니다.

*async*   \_Inout\_\
형식: [XAsyncBlock\*](/reference/system/xasync/structs/xasyncblock)

수행 중인 비동기 작업을 정의하는 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)입니다. [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)을 사용하여 호출 상태를 폴링하고 호출 결과를 검색할 수 있습니다. 자세한 내용은 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)을 참조하세요.

### 반환 값

형식: HRESULT

HRESULT 성공 또는 오류 코드입니다.

## 설명

> !\[NOTE] 이 작업은 예상되는 구매 이후 항목의 다운로드나 설치를 트리거하지 않습니다. 이 콘텐츠를 다운로드하고 설치하려면 성공적인 구매 후 [XStoreDownloadAndInstallPackagesAsync](/reference/system/xstore/functions/xstoredownloadandinstallpackagesasync)를 호출하는 것이 좋습니다. 사용자에게 추가 메시지가 표시되지 않습니다.

> !\[NOTE] PC에서 성공적인 구매 후 표시되는 구매 확인 대화 상자에는 상단에 닫기 버튼\[X]이 있습니다. 확인 대신 이 버튼을 선택하면 `XStoreShowPurchaseUIResult`에 E\_ABORT가 반환되며, 이는 의도되지 않을 수 있습니다. 이는 이러한 방식으로 대화 상자를 닫을 때의 표준 Windows 동작입니다.

이 함수의 결과를 검색하려면 이 함수를 호출한 후 [XStoreShowPurchaseUIResult](/reference/system/xstore/functions/xstoreshowpurchaseuiresult)를 호출합니다. 이 함수는 사용자가 무언가를 구매하기로 선택한 경우에만 호출해야 하며, 결제 정보 및 사용자 확인을 프로세스 외부에서 처리하는 모달 구매 대화 상자를 시스템이 표시하도록 합니다.

다음 코드 조각은 특정 스토어 제품에 대한 구매를 요청하는 예를 보여줍니다.

```cpp theme={null}
void CALLBACK ShowPurchaseUICallback(XAsyncBlock* asyncBlock)
{
    HRESULT hr = XStoreShowPurchaseUIResult(asyncBlock);

    if (FAILED(hr))
    {
        printf("Failed the purchase: 0x%x\r\n", hr);
        return;
    }
}

void ShowPurchaseUI(XStoreContextHandle storeContextHandle, XTaskQueueHandle taskQueueHandle, const char* storeId)
{
    auto asyncBlock = std::make_unique<XAsyncBlock>();
    ZeroMemory(asyncBlock.get(), sizeof(*asyncBlock));
    asyncBlock->queue = taskQueueHandle;
    asyncBlock->callback = ShowPurchaseUICallback;

    HRESULT hr = XStoreShowPurchaseUIAsync(
        storeContextHandle,
        storeId,
        nullptr,    // Can be used to override the title bar text
        nullptr,    // Can be used to provide extra details to purchase
        asyncBlock.get());

    if (FAILED(hr))
    {
        printf("Failed to purchase: 0x%x\r\n", hr);
        return;
    }
}
```

## 요구 사항

**헤더:** XStore.h (XGameRuntime.h에 포함됨)

**라이브러리:** xgameruntime.lib

**지원 플랫폼:** Windows, XBOX One 제품군 콘솔 및 XBOX Series 콘솔

## 개념 설명서

* [게임에서 인게임 구매 구현](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/pc-dev/tutorials/pc-e2e-guide/e2e-services/e2e-in-game-purchases)
* [기본 스토어 작업](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-basic-store-operations)
* [다운로드 가능 콘텐츠(DLC) 관리 및 라이선싱](https://learn.microsoft.com/gaming/gdk/docs/store/commerce/fundamentals/xstore-manage-and-license-optional-packages)
* [XStore 개발 문제 해결](/publishing/xstore-commerce/xstore-troubleshooting)

## 참고 항목

[XStore](/reference/system/xstore/xstore_members)\
[XStoreShowPurchaseUIResult](/reference/system/xstore/functions/xstoreshowpurchaseuiresult)


## Related topics

- [XStoreShowPurchaseUIResult](/ko/reference/system/xstore/functions/xstoreshowpurchaseuiresult.md)
- [XStore 개발 문제 해결](/ko/publishing/xstore-commerce/xstore-troubleshooting.md)
- [기본 스토어 작업](/ko/publishing/xstore-commerce/xstore-basic-operations.md)
- [선택 서비스](/ko/build/gdk-and-engines/optional-services.md)
- [XStore](/ko/reference/system/xstore/xstore_members.md)
