Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to connect Huawei IAP SDK for Inapp payments - 6003 error

I'm trying to connect Huawei IAP SDK for Inapp payments. After adding an app in developer console and some inapp items, I tried to run Iap.getIapClient(activity).isBillingSupported method, but got com.huawei.hms.support.api.iap.json.IapApiException: 6003 error. Can't get any information about that status code, what does it mean. Does anybody know something about it?

like image 939
A.Rubinstein Avatar asked Jan 25 '23 12:01

A.Rubinstein


1 Answers

I had the same problem and here is the fix. The error clearly says that 6003 -> StatusCode.CERT_FINGERPRINT_ERROR. It looks like Huawei can't validate the originality of the app, because of the missing certificate.

You either didn't added agconnect to your project or you're running in a different build type (like debug, that was my issue because I added agconnect several days ago).

If you didn't added the agconnect to your project, make sure you add it. There is an official tutorial how to add it, but here is it in a nutshell:

First of all you need to add the agconnect dependency to your project, download the agconnect-services.json file from Huawei's Developer (from your App). You need to obtain a SHA256 fingerprint with keytool and add this long fingerprint to your Huawei's Developer field. https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/iap-configuring-appGallery-connect#certificate

If you added agconnect (like I did several days ago) and the error persisted, it was because you were running in debug or any other build type which is different than what your official release. If you're running in debug make sure you add the signing certificate to your debug build type.

signingConfigs {
    release {
        storeFile file('C:\\path-to-your\project\signing-certificate.jks')
        keyAlias 'aliasOfYourCertificate'
        keyPassword 'theKeyPasswordOfCertificate'
        storePassword 'theStorePasswordOfCertificate'
    }
}
buildTypes {
    release {
        signingConfig signingConfigs.release
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
    debug {
        signingConfig signingConfigs.release
    }
}

So the key here is adding the signingConfig to your debug build type (if you're running in debug).

like image 142
Zbarcea Christian Avatar answered Feb 12 '23 00:02

Zbarcea Christian