5
votes

Using https://github.com/android-pay/androidpay-quickstart to try Android Pay. Following are the minor changes I made for Android pay to by pass the default Google wallet implementation in the sample.

  1. Installed latest version (8.4.89) of Google Play Services in my device

  2. Changed dependency in the build.gradle file to use 8.3 version as

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

  3. In my device, downloaded "Android Pay" app from play store and successfully added one of supported bank card.

and

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

By doing this, I am able to get Android Pay logo in CheckOutActivity screen similar to first image under Payment flow section in 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 this typically occurs after an app in development switches from the sandbox environment to the production environment.

I have made sure I have environment set up to TEST (WalletConstants.ENVIRONMENT_TEST) in code as follows

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

Please NOTE I have not published this app in play store and I am trying in my local box only and do not want preauthorization to the sample app. Hence I have not followed steps as mentioned in 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

Not sure what mistake I am doing or missing the necessary steps to run this successfully. Any help would be appreciated as I am keen to show this as POC and implement the same in our production app.

2
did you solved it..?? and how.??Abhishek

2 Answers

2
votes

This is stated from Android Pay document

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

5
votes

Did you put these lines in your AndroidManifest.xml?

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