[Huawei Developers] Mike-mei:
HUAWEI In-App Purchases (IAP) enables you to sell a variety of virtual products, including consumables, non-consumables, and subscriptions, directly within your app. To support in-app payment, all you need to do is integrate the IAP SDK and then call its API to launch the IAP checkout screen. Below are some frequently asked questions about IAP and their answers. Hope they are helpful to you.

Q: A monthly subscription doesn't reach the end of a subscription period, and is changed to a yearly subscription in the same subscription group. After I visit the Manage subscriptions screen in Account center and cancel that monthly subscription, the yearly subscription is also canceled. Why is this?​

A: The yearly subscription doesn't take effect until the end of the subscription period during which the subscription change operation is made. So after you cancel the monthly subscription, the yearly subscription that hasn't taken effect will also disappear. Your app will receive a notification about the cancelation of the monthly subscription. As the yearly subscription hasn't taken effect, no relevant cancelation notification will be received.

Q: My app tries to bring up the IAP checkout screen on a Huawei smartwatch, but only receives a message telling me that some HMS Core services need to be updated. After I update it, the update fails (error code: 102).​

A: This error code generally means some kit updates are needed, but no relevant packages are found from HUAWEI AppGallery for smartwatches. If your app running on the smartwatch has integrated the IAP SDK for HarmonyOS (JavaScript), two services need to be updated: JSB Kit and IAP Kit. JSB Kit has already been launched on HUAWEI AppGallery for smartwatches, but IAP Kit still needs some time.

Here's a workaround for you. Make your app request that users download the latest HMS Core (APK) from HUAWEI AppGallery for smartwatches. (See error code 700111, API call error resulting in the update failure.)

Q: IAP has two SDKs: one for Android and the other for HarmonyOS. Are there any differences in the functions and devices supported by the two SDKs?​

Both SDKs provide basic IAP services, including managing orders, making subscriptions, and viewing purchase history, but the SDK for HarmonyOS temporarily does not support non-PMS payment or pending purchase. (PMS stands for Product Management System) In terms of supported devices, the SDK for HarmonyOS supports Huawei phones, smartwatches, and tablets, and the SDK for Android supports not only the devices mentioned above but also non-Huawei phones and head units.

View attachment 5729873

Q: I find that the obtainOwnedPurchasesRecord API in IAP SDK 4.0 or later fails to query non-consumables managed in the PMS and purchased through the productPay API in IAP SDK 2.x. Why?​

A: Data of IAP SDK 4.0 or later and that of IAP SDK 2.x is stored in different databases and temporarily cannot be migrated to the same one, so the problem you've found arises.

Here's a workaround for you. If needed, make your app show only the data generated after IAP SDK 4.0 or later is integrated. For example, if you have integrated IAP SDK 4.0 or later on January 1, 2022, tell users that the starting day of their data query can only be January 1, 2022 or later.

A better way is that you can merge data of IAP SDK 2.x (obtained from the app server) with that of IAP SDK 4.0 or later (obtained through the IAP SDK API) depending on your situation, such as using the same data type for them and placing them on the same server.

Q: During sandbox testing on a Huawei smartwatch, the QR code for payment does not appear after the IAP checkout screen is displayed, and an error indicating incorrect request parameters is reported. What should I do?​

A: Payment through QR code scanning such as on a smartwatch or smart display, is temporarily unsupported in the sandbox environment.

If you do need to test the mentioned payment method, sign in with a non-sandbox account (or if you have only one account, remove it from the sandbox environment) and test the relevant functions in the production environment.

For more information about HUAWEI IAP, please visit the HUAWEI Developers website. Or you can directly click here to find more IAP FAQs.