android-quickstart icon indicating copy to clipboard operation
android-quickstart copied to clipboard

Google pay isReadyToPay method return false

Open Nasimxon opened this issue 7 years ago • 3 comments

I am using Google Pay isReadyToPay method always returns false. When does method returns false or true? Is Google Pay connected to the Locale?

mPaymentsClient = Wallet.getPaymentsClient(activity,
                new Wallet.WalletOptions
                        .Builder()
                        .setEnvironment(WalletConstants.ENVIRONMENT_TEST)
                        .build());

IsReadyToPayRequest request = IsReadyToPayRequest.newBuilder()
                .addAllowedPaymentMethod(WalletConstants.PAYMENT_METHOD_CARD)
                .addAllowedPaymentMethod(WalletConstants.PAYMENT_METHOD_TOKENIZED_CARD)
                .build();
Task<Boolean> task = mPaymentsClient.isReadyToPay(request);
task.addOnCompleteListener(
                new OnCompleteListener<Boolean>() {
                    public void onComplete(Task<Boolean> task) {
                        try {
                            boolean result =
                                    task.getResult(ApiException.class);
                            if (result == true) {
                                 //show Google as payment option
                            } else {
                                 //hide  Google as payment option
                            }
                        } catch (ApiException exception) {
                        }
                    }
 });

Nasimxon avatar Nov 08 '18 14:11 Nasimxon

me too

lb0820ynn avatar Nov 14 '18 03:11 lb0820ynn

Check whether the above code is added in manifest file or not. Add in manifest file, hope it will work.

subhash4android avatar Jan 08 '19 14:01 subhash4android

how to fix it?

wanderwuuu avatar Jun 19 '19 18:06 wanderwuuu