1
votes

When running the braintree demo app for Android from here, it seems to be possible to show the Google Pay option within the Dropin-UI in sandbox mode.

However, when trying to create the Dropin-UI by myself, I am not able to do this, the Dropin only shows the options "Paypal" and "Credit or Debit card".

When looking the docs, I cannot find something missing in my own code/configs.

I added the latest dependencies to my build.gradle:

implementation 'com.braintreepayments.api:drop-in:5.0.1'
implementation 'com.braintreepayments.api:braintree:3.14.2'
implementation 'com.braintreepayments.api:google-payment:3.3.1'
implementation 'com.google.android.gms:play-services-wallet:18.1.2'

I modified my AndroidManifest.xml to contain the following part:

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

I crete the dropin-request using the Tokenization key like this:

DropInRequest dropInRequest = new DropInRequest()
    .clientToken("sandbox_...") //Tokenization key from the Control Panel
    .googlePaymentRequest(getGooglePaymentRequest());

startActivityForResult(dropInRequest.getIntent(MainActivity.this), 4949);

and I create the GooglePaymentRequest like this:

private GooglePaymentRequest getGooglePaymentRequest() {
    GooglePaymentRequest googlePaymentRequest = new GooglePaymentRequest()
        .transactionInfo(TransactionInfo.newBuilder()
            .setTotalPrice("1.00")
            .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
            .setCurrencyCode("USD")
            .build())
        .billingAddressRequired(true);

    return googlePaymentRequest;
}

And I enabled Google Pay in the Control Panel of my Sandbox Account.

enter image description here

But unfortunately, the result is still this:

enter image description here

I scanned the documentations multiple times, but I do not see what could cause this.

Does anyone see what I am missing?

Best regards, Felix

1
Do you have a card or PayPal account stored in the Google account used on your testing device? Google requires it for testinghollabaq
@hollabaq on my real device (that I use for testing), I have a Paypal account configured and a credit card and I am already using Google Pay for some months. On my emulator, there is no configuration for Paypal or a credit card and no other Google Pay config, BUT when running the demo app from github.com/braintree/braintree-android-drop-in/tree/master/Demo the DropIn UI shows the Google Pay option even on the Emulator, and when tapping the Google Pay option, I see a form to setup Google Pay. So I think this must have a different cause.felix

1 Answers

1
votes

After trying to find the cause of this at the wrong position for several days, I finally found it:

Be sure to add the <meta-data android:name="com.google.android.gms.wallet.api.enabled" android:value="true"/> to the application tag within the AndroidManifest.xml, NOT the activity.