Verify in-app purchases for Xbox on Windows
阅读时间1 分钟最后更新于 1 个月前
Use Cloud Code to verify in-app purchases on the server before you grant entitlements.
Server-side purchase verification protects your game against spoofed or tampered purchases. The verification workflow uses a Cloud Code module to call the Microsoft Store Service APIs on the user's behalf.
Prerequisites
Before you set up verification, ensure the following:
- Complete the purchase workflow as described in Implement in-app purchases for Xbox on Windows.
- Create a Cloud Code module with Xbox verification. For instructions, refer to the Cloud Code documentation on Verify Xbox in-app purchases.
Set up verification in the Unity Editor
The Unity In-App Purchasing (IAP) package can automatically validate Xbox Store purchases after you configure the following settings in the Unity Editor:
-
In the Unity Editor, go to Edit >> Services > In-App Purchasing.Project Settings
?
-
In the Xbox Configuration section, enable Validate purchases using Microsoft Store Services, and enter the following:
Property
Description
Cloud Code Module Name The name of the Cloud Code module. Service Ticket Function Name The name of the Access Token function. Validate Purchase Function Name The name of the Validate Purchase function.
After configuration, the IAP package automatically validates purchases when users complete purchases through the Xbox Store. For information about how your Cloud Code module validates purchases with Microsoft Store, refer to Validate purchase ownership.