Huawei consumeOwnedPurchase consumption interface returns -1 error code

Problem phenomenon:

Integrating the IAP service of Huawei HMS SDK, the client uses the createPurchaseIntent payment interface to successfully purchase a product. After the delivery is successful, the call to Huawei's consumption interface consumeOwnedPurchase continues to fail with error code -1.

Problem analysis ideas

Insert picture description here

The interface was called according to the document requirements, and the interface returned the order. According to the official website, the order is not consumed and needs to be invoked.

Insert picture description here

The error code indicates that the problem that I call the consumption interface returns -1 is still not solved. The visual inspection document shows that the payment interface returns -1. You need to see whether the order is dropped. If the order is dropped, you need to make up the order.

  • Check the log hms_pay keyword for why the interface returns -1.

Here combined with the previous experience of communicating with Huawei technical support, the keyword hms_pay was filtered and searched in the log (marked in red and bold, which is the key) , and I found useful information:

Insert picture description here

The information is clear and clear. I checked my code, and it is true that this field is too long~~~~

summary

If you encounter an abnormal error code related to Huawei HMS IAP in the future, you can document the error code first, and then look at Huawei’s prompt information with the hms_pay keyword, and share the new skills with everyone~~ Take it away.


Original link:
https://developer.huawei.com/consumer/cn/forum/topic/0201405817414000262?fid=18
Author: AppGallery Connect

Guess you like

Origin blog.51cto.com/14772288/2573153