HMS Core In-App Purchases (IAP) provides a convenient in- app payment experience and easy access process for applications. After the developer's application integrates the IAP SDK, the developer can call the IAP SDK interface and start the IAP cashier to realize in-app payment.

Through the in -app payment service , users can purchase various types of virtual goods within the application, including one-time goods (both consumable and non-consumable) and subscription goods. The editor summarizes some of the problems in the process of integrating in-app payment services that developers are more concerned about during this period, and provides solutions for everyone to use as needed.

Question 1. For the same subscription group, the continuous monthly subscription has not expired, and the continuous monthly subscription is switched to the continuous annual subscription. Why is the continuous annual subscription also cancelled on the HUAWEI ID Center Subscription Management page?

Cause Analysis:

After switching from continuous monthly subscription to continuous annual subscription, the product is not (to be) effective. If the continuous monthly subscription product is canceled at this time, the continuous monthly subscription cancellation notification event will be sent. Since the annual subscription has not taken effect at this time, it will not be sent for the time being. Unsubscribe event for consecutive years.

Question 2: On the Huawei smart watch, call the cashier interface, and it prompts "This application requires a higher version of HMS Core related components to be used. Do you want to update it now?" Click Update, and it prompts that the update failed with error 102.

Cause Analysis:

This error code generally means that the sub-Kit needs to be upgraded, but there is no related sub-application on the watch app market, so the installation package cannot be found. To integrate the JS SDK on Huawei smart watches, the two main sub-Kits that need to be upgraded are JSB Kit and IAP Kit. At present, JSB Kit has been put on the app market, and IAP Kit is still in the schedule.

Solution:

If this prompt is encountered, we can use a circumvention scheme, that is, prompt the user to manually download the latest HMS Core APK from the watch application market, and handle it according to the returned error code of 700111 .

Question 3. The in-app payment service provides Android and HarmonyOS SDKs. What is the difference between the supported functions and devices?

The app can realize in-app payment by integrating the IAP SDK, and then calling the IAP SDK interface to start the IAP cashier. Both Android and HarmonyOS SDKs provide basic in-app payment services, including order management, subscriptions, viewing purchase history, etc.; however, HarmonyOS SDK currently does not support non-PMS payment and delayed payment payment. In terms of supported devices, the HarmonyOS SDK supports Huawei mobile phones, Huawei watches, and Huawei tablets; the Android SDK supports non-Huawei mobile phones and car devices in addition to Huawei devices.

Please refer to the following table for details:

Question 4. Why can't the acquireOwnedPurchasesRecord of the SDK interface of in-app payment version 4.0 or above be able to query the PMS non-consumable commodity orders purchased by the 2.0 SDK interface productPay?

Cause Analysis:

The data of in-app payment version 4.0 and above and version 2.0 are not in the same database, and cannot be merged temporarily, so those who use the new interface cannot query the previous order.

Solution:

  1. If there is a need to display historical data in the application, you can only display the data of the SDK version after the integration of 4.0, such as the integration update in January 22, you can prompt this page to query only the purchase data after January 22. (refer to)
  2. Developers can integrate the purchase data of the previous version 2.x (obtained from the application service side) and the data obtained from the sdk (from the IAP SDK interface) of versions after 4.0 for integrated processing. (recommend)

Question 5. On the Huawei smart watch, it has entered the sandbox test environment. After pulling up the cashier, the payment QR code is not displayed, indicating that the request parameter is incorrect.

Cause Analysis:

At present, the payment methods of scanning code do not support sandbox testing for the time being. For example, watches, smart screens, etc. are all paid by scanning code, so corresponding error prompts will appear.

Solution:

Log in to a non-sandbox account (or delete a sandbox account) and trigger the Internet environment for testing.

Learn more details>>

Visit the official website of Huawei Developer Alliance
Get development guidance documents
Huawei Mobile Services Open Source Warehouse Address: GitHub , Gitee

Follow us to know the latest technical information of HMS Core for the first time~


HarmonyOS_SDK
596 声望11.7k 粉丝

HarmonyOS SDK通过将HarmonyOS系统级能力对外开放,支撑开发者高效打造更纯净、更智能、更精致、更易用的鸿蒙应用,和开发者共同成长。