Huawei's In-App Purchases (IAP) service provides developers with a convenient in-app payment experience and easy access process. 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. During the integration process, developers may encounter the problem of error reporting. At this time, we can quickly troubleshoot and locate the problem by finding the tag in the log. Below, we will combine two practical problems to see how to use this method.

Question 1: A developer invokes Huawei's in-app payment SDK, opens the cashier page, and prompts "The current payment service is unavailable, please try again later". Refer to the following figure for details:

problem analysis

1. First, we confirm which interface of IAP is called.

By looking at the logs given by the developer, we found that the non-PMS interface was called (by filtering IapClientImpl, we can query the called interface name)

2. If it is pms, the called cashier interface is called createPurchaseIntent, and if it is a non-pms interface, the called interface is called createPurchaseIntentWithPrice.

3. According to the dialog box indicating that the payment service is unavailable, it may be that the payment service api switch is not turned on or some regions do not support payment. According to this idea, we locate and search for tag: "hms_pay" in the log:

The log shows that the current service location is France, but the current in-app payment service to purchase non-PMS goods only supports mainland China, so it will prompt that payment is unavailable.

Solution

Switch the service location back to China in the App Market. The specific operations are as follows: App Market -> Settings -> Country/Region -> China.

summary of a problem

During the debugging process, if the interface fails or an error is prompted, the following tags can be used to locate the problem:

HMSSDK : You can use this tag to check whether the HMS Core SDK framework side is abnormal, such as 6003, 6004, 90713XXXX and other error codes, and of course it also includes the IAP SDK side error codes. Such as 60002, 60050, etc.

hms_pay : If there are IAP SDK side error codes such as 60002, 60050, etc., you can analyze the possible problems through the IAP APK side, that is, you can use this tag to locate and analyze the subsequent APK side logs.

Network-Request : This tag actually belongs to hms_pay and belongs to the error code returned by the service test . We can conduct preliminary investigation and positioning against the service test document according to the error code and error description returned by the service side. Such as 8, 9, 11, 12 and other error codes.

Question 2: A developer reports an error when calling the "isEnvReady" method, prompting "This application is not released in the current country/region". Refer to the following figure for details:

problem analysis

First, we searched the log for the tags HMSSDK and hms_pay, and found an error code of 60007. Compared with the business error code, it indicated that the region where the product was configured was not distributed to the country.

According to the error code prompt, we went to the AGC website to check the country and region of release, and found that the current app release location is set in Europe, but the current login account is in mainland China, so this error will be prompted.

Solution

Open the AGC website, go to the application shelf -> ready to submit page , select the country or region of release to mainland China (if you want to put it on the shelf in a certain country or region, you need to select the corresponding country or region), select it and click save, Changes generally take effect within a few hours.

summary of a problem

It is basically the same as the positioning idea of Question 1. Preliminary positioning is performed based on the error code. First of all, we must judge the possible problems according to the client error code. If we have obtained the corresponding client error code, we can handle it according to the meaning of the error code and the solution on the official website.

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系统级能力对外开放,支撑开发者高效打造更纯净、更智能、更精致、更易用的鸿蒙原生应用,和开发者共同成长。