Unity partner page:
Xiaomi developer quick start guide:
Unity IAP Xiaomi integration guide:
https://docs.unity3d.com/Manual/UnityIAPXiaomi.html
Unity Channel SDK and API extensions:
https://docs.unity3d.com/Manual/UnityIAPXiaomiAPI.html
1. How may I test Xiaomi Mi Game Pay for Unity IAP (Xiaomi IAP)?
If you set appInfo.debug to true when initializing Xiaomi IAP, you’ll be able to test Xiaomi IAP without real money.
If you want to test real purchasing, you must set appInfo.debug to false. Please note that real purchasing requires a Xiaomi Mi Account and appropriate currency such as Chinese Yuan.
You can create a Mi Account on a Xiaomi device or Xiaomi official page: https://account.xiaomi.com
2. I found an “Unavailable product…” log message and OnInitializeFailed() was fired with an InitializationFailureReason.NoProductsAvailable reason.
Xiaomi IAP needs an IAP Catalog for product metadata before purchase.
Configure all your products in [Window > Unity IAP > IAP Catalog].
And then export the products by clicking “App Store Export → Xiaomi Mi Game Pay Catalog”.
This step will export all products to “Assets\Plugins\Android\assets\MiGameProductCatalog.prop” which will be read by the Xiaomi SDK.
3. How can I see the Xiaomi IAP log?
In Android Studio, you can filter log with “(/Unity)|(/MiGameSDK)”.
4. How to restore my products in Xiaomi store?
Xiaomi IAP doesn’t have “Restore” feature. If a user bought a non-consumable product and reinstalled your game, when he/she tries to buy again, OnPurchaseFailed() will be fired with a PurchaseFailureReason.DuplicateTransaction reason.
More information can be found in [Assets\Plugins\UnityPurchasing\script\IAPDemo.cs].
5. What version of Unity should I use if I want to integrate Xiaomi IAP?
Xiaomi IAP supports 5.3+.
6. I can’t buy a product when I set appInfo.debug to true, I found a “3001” error code in logcat printed by Xiaomi SDK.
“3001” means “product doesn’t exist”. Please contact with Xiaomi to check your product IDs.
7. When should our game make the call to login into the StoreService? Just before the player makes a purchase or rather at game startup?
(* Copied from IAPDemo.cs)
You just need to make sure that players login successfully before you call InitiatePurchase(). So both before the player makes a purchase and game startup are OK. It’s up to you.
8. I tried to sign in with Mi Account on my device, I have an error in unityChannelLoginHandler.loginFailedAction with “User Login Failed:-400” in the log.
Please contact with Xiaomi to confirm that your products have been configured.
9. We need the link to redirect player to the review page of the store during the game.
You can use “market://details?id=your package name” as an Intent to redirect player to the review page of Xiaomi store.
The URL for your game in Xiaomi app store(website) is “http://app.mi.com/details?id=your package name”.
10. My app crashed during initialization of UnityIAP and I found this crash log.
All of appId, appKey, clientId, clientKey are necessary for the initialization of UnityChannel. So if any of them is null or empty, an exception should be thrown.
appId and appKey can be any value in debug mode.
11. I can’t push my apk to Xiaomi Dev Portal. There is no “Push to Xiaomi” option on my Cloud Build dashboard.
The “Push to Xiaomi” option is only available to the Owner of the organization.
Other Tips
-
Google Play services are not allowed in Xiaomi store.
-
Xiaomi IAP needs an extra login step which other app stores don’t have. Please refer to Q7.
-
App package name must end with “.mi”.
-
The prices must follow the tiers of Xiaomi IAP. All tiers can be found in “IAP Catalog” window. [Window → Unity IAP → IAP Catalog]

