HMS-Core / hms-react-native-plugin

This repo contains all of React-Native HMS plugins.
https://developer.huawei.com/consumer/en/doc/overview/HMS-Core-Plugin?ha_source=hms1
Apache License 2.0
245 stars 68 forks source link

[@hmscore/react-native-hms-iap] Sandbox testing doesn't work #186

Closed yaroslavnikiforov closed 2 years ago

yaroslavnikiforov commented 2 years ago

Description I added my Huawei ID to the test accounts in AppGallery Connect according to the instruction but I don't get any dialogs that it is a test: https://developer.huawei.com/consumer/en/doc/distribution/app/agc-help-testaccount-0000001146438651 https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/sandbox-testing-0000001050035039

Expected behavior Should see messages about sandbox testing on the checkout screen.

Screenshot 2022-04-22 at 21 41 40

Current behavior Don't have any test messages on the checkout screen.

Screenshot_20220422_212153_com huawei hwid

Logs Response for HMSIapModule.isSandboxActivated()

{
  "status": {
    "hashCode": 947086020,
    "describeContents": 0,
    "isCanceled": false,
    "hasResolution": false,
    "isSuccess": true,
    "statusMessage": "success",
    "isInterrupted": false,
    "statusCode": 0,
    "errorString": "success"
  },
  "versionInApk": "2120",
  "returnCode": 0,
  "isSandboxUser": true,
  "versionFrMarket": "2120",
  "isSandboxApk": false,
  "errMsg": "The versionInApk should be more advanced than versionFrMarket"
}

Environment

"react-native": "0.63.4",
"@hmscore/react-native-hms-iap": "^6.3.0-300",

Screenshot_20220422_215814_com huawei hwid

yaroslavnikiforov commented 2 years ago

Also payOrderId property in InAppPurchaseData returned by obtainOwnedPurchases method is equal to "SandBox_1650649777607.4CF742B3.0023", but in HMS Core app I have a real subscription

Screenshot_20220425_181053_com huawei hwid

yaroslavnikiforov commented 2 years ago

The solution is in this message from HMSIapModule.isSandboxActivated() response: "errMsg": "The versionInApk should be more advanced than versionFrMarket"

So versionCode in defaultConfig under android/app/build.gradle should be higher than the latest released app version in AppGallery.