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

# XStoreShowGiftingUIAsync

> XStoreShowGiftingUIAsync

# XStoreShowGiftingUIAsync

지정된 제품을 다른 사용자에게 선물로 구매하기 위한 UI 오버레이를 시작합니다. 현재 사용자에게 선물 수신자에 대한 정보를 입력하라는 메시지가 표시되고 구매 흐름을 안내합니다.

## 구문

```cpp theme={null}
HRESULT XStoreShowGiftingUIAsync(  
         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 성공 또는 오류 코드입니다.

## 설명

선물로 구매할 제품은 선물 구매를 지원하도록 구성되어야 합니다. 선물을 지원하는 제품 목록을 검색하려면 `actionFilters` 매개 변수를 `"Gift"`로 설정하여 [XStoreQueryProductsAsync](/reference/system/xstore/functions/xstorequeryproductsasync)를 호출합니다.

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

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

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

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

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

    HRESULT hr = XStoreShowGiftingUIAsync(
        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 콘솔

## 참고 항목

[XStore](/reference/system/xstore/xstore_members)\
[XStoreShowGiftingUIResult](/reference/system/xstore/functions/xstoreshowgiftinguiresult)


## Related topics

- [XStoreShowGiftingUIResult](/ko/reference/system/xstore/functions/xstoreshowgiftinguiresult.md)
- [XStore](/ko/reference/system/xstore/xstore_members.md)
- [XStoreShowPurchaseUIAsync](/ko/reference/system/xstore/functions/xstoreshowpurchaseuiasync.md)
- [XStoreShowAssociatedProductsUIAsync](/ko/reference/system/xstore/functions/xstoreshowassociatedproductsuiasync.md)
- [XStoreShowProductPageUIAsync](/ko/reference/system/xstore/functions/xstoreshowproductpageuiasync.md)
