Basic DRM and license checks
XStore on PC includes a basic DRM check: the title verifies it has an active license before allowing gameplay. The check runs at startup viaXStoreQueryGameLicenseAsync.
If no license is found:
- Show the player a Store UI to purchase or sign in.
- Don’t let gameplay proceed without an active license.
- Validate the license via license tokens from your service.
- Periodically re-check
XStoreQueryGameLicenseAsyncduring gameplay; revoke on license loss.
Open vs. restrictive licensing
Two PC licensing models:- Open licensing — the player can run the title with any Microsoft Store account that has a license. Useful for shared PCs.
- Restrictive licensing — the player must be signed in with the licensed Microsoft Account. Used when titles want stronger anti-piracy.
License tokens for service validation
If your game server needs to confirm the player owns the title (e.g., before granting an in-game asset), use license tokens:- Client calls
XStoreQueryLicenseTokenAsyncto get a short-lived signed token. - Client sends the token to your service.
- Your service validates the token’s signature with the Microsoft public key.
- Your service trusts the token’s claims about license state.
Mismatched store account scenarios
A common PC issue: the player is signed in to Windows / the XBOX app with one Microsoft Account, but the Microsoft Store is signed in with a different account. XStore APIs follow the Store’s signed-in account, which can lead to:- Title shows “buy” even though the XBOX-signed-in player owns it on the other account.
- Purchase succeeds against the wrong account.
- Detect the mismatch — compare
XUserGetIdtoXStoreQueryGameLicenseAsyncinfo. - Show UI explaining the mismatch and offer to switch.
- If the player can’t switch, offer to redirect them through the XBOX app to fix the Store account.
Sandbox switching for store operations
The XBOX services sandbox (set viaXblPCSandbox.exe) doesn’t fully control what sandbox the Store uses on PC. Store operations need an additional step:
- Switch the XBOX services sandbox.
- Re-launch the Microsoft Store app in the new sandbox context.
- Verify with
XStoreQueryGameLicenseAsyncreturns dev-sandbox data.
Testing checklist for PC commerce
Before submitting:- Test with a test account that owns nothing — verify the buy / trial / sign-in flow.
- Test with a test account that owns the base game — verify no “buy” prompts appear.
- Test mismatched store accounts — sign in to Windows with one account, Store with another.
- Test trial → buy flow — verify the trial license switches to full license without restart.
- Test offline launch — PC titles must launch and play offline (no Store contact) for a reasonable cached-license window.
- Test sandbox switching — confirm Store calls return dev-sandbox products after the switch.
Related API documentation
- XStore API reference —
XStoreQueryGameLicenseAsync,XStoreQueryLicenseTokenAsync - XUser API reference —
XUserGetId,XUserIsStoreUser
