A.Rubinstein
A.Rubinstein

Reputation: 133

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?

Upvotes: 6

Views: 3960

Answers (2)

Zbarcea Christian
Zbarcea Christian

Reputation: 9548

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).

Upvotes: 12

Emre Türker
Emre Türker

Reputation: 41

  1. Check whether the certificate fingerprint is correctly configured on HUAWEI Developer. Sign into HUAWEI Developer, go to Management Center > My Products, and select the services that require fingerprint certificate. In the product service list, check whether the SHA256 certificate fingerprint is same as the one you obtained. If not, modify the SHA256 certificate fingerprint, then clear the HMS cache.
  2. If the issue persists, contact HUAWEI support.

Resource: https://developer.huawei.com/consumer/en/service/hms/catalog/huaweiid.html?page=hmssdk_huaweiid_api_reference_errorcode

Upvotes: 0

Related Questions