ERROR_CODE_MERCHANT_ACCOUNT_ERROR (405) while trying Android Pay in TEST environment using Google Sample Code

ERROR_CODE_MERCHANT_ACCOUNT_ERROR (405) while trying Android Pay in TEST environment using Google Sample Code

使用https://github.com/android-pay/androidpay-quickstart尝试Android支付。 以下是我对 Android 进行的细微更改,以绕过示例中的默认 Google 钱包实现。

  1. 在我的设备中安装了 Google Play 服务的最新版本 (8.4.89)

  2. 更改了 build.gradle 文件中的依赖项以使用 8.3 版本作为

    编译'com.google.android.gms:play-services-wallet:8.3.0'

  3. 在我的设备中,从 Play 商店下载 "Android Pay" 应用程序并成功添加一张支持的银行卡。

WalletFragmentStyle walletFragmentStyle = new WalletFragmentStyle()
            .setBuyButtonText(BuyButtonText.BUY_WITH_GOOGLE)
            .setBuyButtonAppearance(WalletFragmentStyle.BuyButtonAppearance.ANDROID_PAY_LIGHT)
            .setMaskedWalletDetailsLogoImageType(WalletFragmentStyle.LogoImageType.ANDROID_PAY)
            .setBuyButtonWidth(Dimension.MATCH_PARENT);

通过这样做,我能够在 CheckOutActivity 屏幕中获得 Android 支付徽标,类似于 https://developers.google.com/android-pay/payment-flows. But when I click "Buy With Android(logo) Pay" I am getting error code 405. As per under section "Invalid signing key fingerprint" in https://developers.google.com/android-pay/best-practices 中支付流程部分下的第一张图片,这通常发生在开发中的应用程序从沙箱切换之后环境到生产环境。

我已确保在代码中将环境设置为测试 (WalletConstants.ENVIRONMENT_TEST),如下所示

WalletFragmentOptions walletFragmentOptions = WalletFragmentOptions.newBuilder()
            .setEnvironment(WalletConstants.ENVIRONMENT_TEST)
            .setFragmentStyle(walletFragmentStyle)
            .setTheme(WalletConstants.THEME_LIGHT)
            .setMode(WalletFragmentMode.BUY_BUTTON)
            .build();

请注意,我尚未在 Play 商店中发布此应用程序,我只是在我的本地盒子中尝试,不希望对示例应用程序进行预授权。因此,我没有按照 https://developers.google.com/android-pay/preauth . Hence I am not able to verify "fingerprint provided to Google matches the fingerprint of the key used to sign the Android app" as mentioned in section "Invalid signing key fingerprint" in https://developers.google.com/android-pay/best-practices

中提到的步骤进行操作

不确定我犯了什么错误或错过了成功 运行 的必要步骤。任何帮助将不胜感激,因为我很想将其展示为 POC 并在我们的生产应用程序中实施。

您是否将这些行放入 AndroidManifest.xml?

    <meta-data
        android:name="com.google.android.gms.wallet.api.enabled"
        android:value="true" />

这来自Android付款文件

Remember to sign your app with release keys

When your app is pointed to the Android Pay production environment, the Android Pay API returns ERROR_CODE_MERCHANT_ACCOUNT_ERROR (405) if the signing key fingerprint used to sign the Android app does not match the release key fingerprint registered with Google Play. This typically occurs after an app in development switches from the test environment to the production environment

https://developers.google.com/android-pay/deployment