Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 1.61 KB

File metadata and controls

28 lines (20 loc) · 1.61 KB
title description author ms.author ms.date ms.topic keywords ms.custom
In-app purchases
Learn how to use in-app purchases in your mixed reality apps with a 2D XAML view and stock Windows OS popup.
thetuvix
alexturn
05/23/2022
how-to
in-app purchases, hololens, XAML, mixed reality headset, windows mixed reality headset, virtual reality headset
kr2b-contr-experiment

In-app purchases

HoloLens supports in-app purchases (IAPs), but there's some work to set them up.

To use the in app-purchase functionality:

  1. Create a XAML 2D view to appear as a slate.

  2. Switch to the XAML view to activate placement, which leaves the immersive view.

  3. Call the RequestProductPurchaseAsync API:

    await CurrentApp.RequestProductPurchaseAsync("DurableItemIAPName");

    The RequestProductPurchaseAsync API brings up the stock Windows OS popup that shows the in-app purchase name, description, and price. The user can then choose purchase options.

  4. Once the user completes the purchase, present UI that lets the user switch back to the app's immersive view.

Apps that target desktop-based Windows Mixed Reality immersive headsets don't need to manually switch to a XAML view before they call the RequestProductPurchaseAsync API.