Getting started with Google Pay for Android SDK

  Last updated: 


  Google Pay is only supported on Payment SDK version 2.5.1 and above.

To begin your Google Pay integration for in-app payments, you will need to confirm/request the following details from our Support Team:

  • Confirm your acquiring bank supports Google Pay as a payment option.

  • Request a test and live site reference, with Google Pay added as an enabled feature and enable 3-D Secure for both test and live accounts.

  • Request a JWT username & secret key linked to your test site reference.

  • If you’ve not had any prior experience with our payment SDK, then you will need to follow the steps to install the SDK in your app.

  • You will need to register for a Google account (if you don't have one already) and perform some basic configuration in order to begin testing (as described below).


Set up your Google account for testing

To begin testing Google Pay when targeting a test environment, you will need a Google account and you will need to join a group Google provides that allows you to use a set of API test cards for testing your Google Pay solution.

  1. Once you have registered a Google account, sign in to the account in your browser, navigate to the following page:
  2. Then click "Join group".


  3. Once you have set your preferences, click "Join group".


  4. You will be presented with a page that confirms you have been granted access to the Google test suite:


  5. To ensure this is working, Google provide a demo page where you can click a Google Pay button to view the payment form.
        Click here to open this in a new tab (link to external site).

    If everything is working as expected, you should be able to select any of the example payment methods and click "CONTINUE". This will process a test payment.



Configuring your payment checkout

  Ensure you have completed all of the steps above before proceeding.


Update your build.gradle file

Add the following dependencies to your app-level build.gradle file:

dependencies {​​​​​​​​
implementation "$wallet_version"
implementation "$support_version" //ensure that you have the following dependency


App Manifest

In your app project manifest file, inside the application tag, please add the following entry:

android:value="true" />


Configure the instance

This would be considered the minimum number of parameters required to configure the Google Pay manager:

tpGooglePayManager = TPGooglePayManager.Builder(
<merchant site reference> //e.g. test_site123 or site123


If you require further configuration of the Google Pay manager, you can specify any of the following options before calling the .build method:

setApiVersion(@NonNull apiVersion : Int) //e.g. 2
fun setGateway(@NonNull gateway : String) //i.e. trustpayments
setApiVersionMinor(@NonNull apiVersionMinor : Int) // e.g. 0
setAllowedCardNetworks(@NonNull supportedNetworks : List<String>) //e.g. listOf("AMEX","VISA","MASTERCARD","JCB","DISCOVER")
setBillingAddressRequired(@NonNull billingAddressRequired : Boolean, @NonNull format : String, @NonNull phoneNumberRequired : Boolean = false) e.g. // format=MIN or FULL
setShippingAddressRequired(@NonNull shippingAddressRequired : Boolean, @NonNull allowedCountryCodes : List<String>, @NonNull phoneNumberRequired : Boolean = false) //e.g. allowedCountryCodes=listOf("GB", "US")
setRequestCode(@NonNull requestCode : Int) // Default is 8686, but you can set this to be any integer value
setMerchantName(@NonNull merchantName : String) // The name of the merchant displayed on the Google Pay Window
setAllowedCardAuthMethods(@NonNull allowedCardAuthMethods : List<String>) // listOf("PAN_ONLY","CRYPTOGRAM_3DS") or listOf("PAN_ONLY")

This is how to configure the instance with optional properties (e.g. To only allow for Visa cards to be used for processing payments with Google Pay):

tpGooglePayManager = TPGooglePayManager.Builder(


  For a full list of properties provided by Google, please visit their API documentation as a reference. You won't be required to copy any code from their documentation. Rather, you will only need to reference the supported values for each property:

  Google Pay can be included in either a custom app view or the payment SDK's pre-built view. In both cases, you will add the button into the view, capture the Google wallet token (i.e. the payment data) and finally an additional API call will be required to submit the Google wallet token in an authorisation request.

If you would prefer to add the Google Pay button in a custom view you have developed, then you should read the Add Google Pay button to custom view in your app page. Otherwise, if you prefer to utilise the payment SDK's pre-built view, which can optionally display Google Pay, then please read the Add Google Pay button to Drop-In View page.

Was this article helpful?
0 out of 0 found this helpful