0
votes

I have implemented Braintree SDK which supports pay using Paypal, Credit or Debit Card and Google Pay.

All are working except Google Pay. I am getting following error while selecting payment method as GooglePay.

This merchant is not enabled for Google Pay Even I have enabled Google Pay option on Braintree console.

following is the code for implementation:

Code on Pay button click:

DropInRequest dropInRequest = new DropInRequest()
                    .amount(strAmount)
                    .googlePaymentRequest(getGooglePaymentRequest())
                    .tokenizationKey("production_key_xxxxxxxxx");
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                startActivityForResult(dropInRequest.getIntent(getActivity()), 399);
            }



private GooglePaymentRequest getGooglePaymentRequest() {
            return new GooglePaymentRequest()
                    .transactionInfo(TransactionInfo.newBuilder()
                            .setTotalPrice(strAmount)
                            .setCurrencyCode("USD")
                            .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
                            .build())
                    .emailRequired(true);
        }

Help would be appreciated.

3
fstanis answer is correct. Don't forget to run your Braintree server side implementation in SANDBOX mode, otherwise they can't test it! This is also the reason you get the message above. For testing you need 1) Braintree website: Enable GooglePay (Sandbox) 2) Braintree server implementation switched to SANDBOX (don't forget to use SANDBOX keys as well) 3) Client implementation: WalletConstants.ENVIRONMENT_TEST - Adam Ri
have you found the solution why was it not working? - Farhana Naaz Ansari
Which environment were you having issues with? Test/sandbox or production? - Soc

3 Answers

0
votes

Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support.

It looks like you're trying to pass the incorrect Google Pay object for a standalone Google Pay integration through Braintree into your Drop-in UI.

If you haven't already, you need to include the Google Pay meta tag in your AndroidManifest.xml:

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

Then, construct a GooglePaymentRequest object and pass it to your DropInRequest object. The object may look something like:

private void enableGooglePay(DropInRequest dropInRequest) {
    GooglePaymentRequest googlePaymentRequest = new GooglePaymentRequest()
      .transactionInfo(TransactionInfo.newBuilder()
        .setTotalPrice("1.00")
        .setTotalPriceStatus(WalletConstants.TOTAL_PRICE_STATUS_FINAL)
        .setCurrencyCode("USD")
        .build())
      .billingAddressRequired(true); // We recommend collecting and passing billing address information with all Google Pay transactions as a best practice.

    dropInRequest.googlePaymentRequest(googlePaymentRequest);
}

You can find more information about this in our developer docs.

0
votes

To use the Google Pay API in production, you need to have it enabled for your app on Google's side as well.

Their Integration checklist is a good place to start, specifically it has a section called Requesting production access

0
votes

You also need to add googleMerchantId("YOUR-MERCHANT-ID")

The merchantId parameter inside PaymentDataRequest must be set to the value provided in your Google Pay Developer profile.

https://developers.google.com/pay/api/web/support/troubleshooting#merchantId