Google Pay

Client-Side Implementationanchor

Choose an integration methodanchor

You can accept Google Pay with either our Drop-in UI or a custom integration.

Drop-in integrationanchor

Our Drop-in UI is the fastest way to set up your client-side integration.

For full details, see Drop-in Setup and Integration.

Custom integrationanchor

Add the following in your app-level build.gradle:

  1. Groovy
dependencies {
  implementation 'com.braintreepayments.api:google-pay:4.39.0'


First, create a BraintreeClient with a ClientTokenProvider or Tokenization Key. Then construct a GooglePayClient.

Before showing the Google Pay button, use the GooglePayClient#isReadyToPay method to check whether the user's current device is compatible. When the result is true, show the Google Pay button. When the result is false, display other checkout options.

  1. Kotlin
  2. Java
braintreeClient = BraintreeClient(this, ExampleClientTokenProvider())
googlePayClient = GooglePayClient(this, braintreeClient)
googlePayClient.isReadyToPay(this) { isReadyToPay, error -> 
  if (isReadyToPay) {
    // show Google Pay button

You will need a button element on your page styled according to Google's brand guidelines.

The CARD payment method type is supplied by the Braintree Android SDK as an allowed payment method when making the IsReadyToPayRequest. It also provides the PAYPAL payment method type if you are using Google Pay v2 and currently accept PayPal payments. If you desire different behavior for the IsReadyToPayRequest, you can follow Google's documentation and make the IsReadyToPayRequest outside of the Braintree Android SDK.

Requesting a paymentanchor

Google Pay requires a price to be specified using the 'TransactionInfo' object. Build a 'TransactionInfo' object and provide it at the time of payment, along with your Google-provided googleMerchantId for production transactions.

Implement a GooglePayListener to receive results, and call 'requestPayment' to invoke the payment flow.

  1. Java
  2. Kotlin
public class MyActivity extends AppCompatActivity implements GooglePayListener {
  private BraintreeClient braintreeClient;
  private GooglePayClient googlePayClient;

  protected void onCreate(Bundle savedInstanceState) {
    braintreeClient = new BraintreeClient(this, new ExampleClientTokenProvider());
    googlePayClient = new GooglePayClient(this, braintreeClient);

  public void onGooglePayButtonClick(View view) {
    GooglePayRequest googlePayRequest = new GooglePayRequest();

    googlePayClient.requestPayment(this, googlePayRequest);

  public void onGooglePaySuccess(@NonNull PaymentMethodNonce paymentMethodNonce) {
      // send paymentMethodNonce.getString() to server

  public void onGooglePayFailure(@NonNull Exception error) {
    if (error instanceof UserCanceledException) {
      // user canceled
    } else {
      // handle error

Next Page: Server-side