Version: Unity 6.4 (6000.4)
Language : English
Implement in-app purchases with Unity IAP APIs
Windows build settings reference

Verify in-app purchases with Cloud Code

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.

Note: Purchase verification is optional. It’s recommended to implement verification for purchases that grant entitlements of meaningful value to user accounts.

Prerequisites

Before you set up verification, ensure the following:

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:

  1. In the Unity Editor, go to Edit > Project Settings > Services > In-App Purchasing.

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

Note: The Cloud Code module grants entitlements only for products that Microsoft confirms the user owns.

Additional resources

Implement in-app purchases with Unity IAP APIs
Windows build settings reference