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 |
HoloLens supports in-app purchases (IAPs), but there's some work to set them up.
To use the in app-purchase functionality:
-
Create a XAML 2D view to appear as a slate.
-
Switch to the XAML view to activate placement, which leaves the immersive view.
-
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. -
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.